summaryrefslogtreecommitdiffstats
path: root/crypto/ui/ui_lib.c
diff options
context:
space:
mode:
authorFdaSilvaYY <fdasilvayy@gmail.com>2016-06-27 21:57:58 +0200
committerMatt Caswell <matt@openssl.org>2016-07-05 18:45:50 +0200
commit68efafc513788863339c199d22048ef275832094 (patch)
tree2a409883db3b7f56d4571d77735c964bed640669 /crypto/ui/ui_lib.c
parentReorganise asn1.h and add comments. (diff)
downloadopenssl-68efafc513788863339c199d22048ef275832094.tar.xz
openssl-68efafc513788863339c199d22048ef275832094.zip
Add checks on sk_TYPE_push() returned value
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'crypto/ui/ui_lib.c')
-rw-r--r--crypto/ui/ui_lib.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/ui/ui_lib.c b/crypto/ui/ui_lib.c
index 2940b2fd4a..8992ae77c2 100644
--- a/crypto/ui/ui_lib.c
+++ b/crypto/ui/ui_lib.c
@@ -127,8 +127,10 @@ static int general_allocate_string(UI *ui, const char *prompt,
s->_.string_data.test_buf = test_buf;
ret = sk_UI_STRING_push(ui->strings, s);
/* sk_push() returns 0 on error. Let's adapt that */
- if (ret <= 0)
+ if (ret <= 0) {
ret--;
+ free_string(s);
+ }
} else
free_string(s);
}
@@ -172,8 +174,10 @@ static int general_allocate_boolean(UI *ui,
/*
* sk_push() returns 0 on error. Let's adapt that
*/
- if (ret <= 0)
+ if (ret <= 0) {
ret--;
+ free_string(s);
+ }
} else
free_string(s);
}