summaryrefslogtreecommitdiff
path: root/apps/ts.c
diff options
context:
space:
mode:
authorYuchi <yt8mn@virginia.edu>2017-02-05 19:33:47 -0500
committerMatt Caswell <matt@openssl.org>2017-02-14 10:19:50 +0000
commite0670973d5c0b837eb5a9f1670e47107f466fbc7 (patch)
tree1e4d59ce584d3c4c508bd790c5f2e8337087f3e5 /apps/ts.c
parentb84460ad3a3e4fcb22efaa0a8365b826f4264ecf (diff)
downloadopenssl-new-e0670973d5c0b837eb5a9f1670e47107f466fbc7.tar.gz
mem leak on error path and error propagation fix
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2559)
Diffstat (limited to 'apps/ts.c')
-rw-r--r--apps/ts.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/ts.c b/apps/ts.c
index 6c0adb1423..0db6b509f8 100644
--- a/apps/ts.c
+++ b/apps/ts.c
@@ -887,9 +887,15 @@ static TS_VERIFY_CTX *create_verify_ctx(const char *data, const char *digest,
goto err;
f = TS_VFY_VERSION | TS_VFY_SIGNER;
if (data != NULL) {
+ BIO *out = NULL;
+
f |= TS_VFY_DATA;
- if (TS_VERIFY_CTX_set_data(ctx, BIO_new_file(data, "rb")) == NULL)
+ if ((out = BIO_new_file(data, "rb")) == NULL)
+ goto err;
+ if (TS_VERIFY_CTX_set_data(ctx, out) == NULL) {
+ BIO_free_all(out);
goto err;
+ }
} else if (digest != NULL) {
long imprint_len;
unsigned char *hexstr = OPENSSL_hexstr2buf(digest, &imprint_len);