diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-06-22 16:33:13 +0200 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2020-06-24 23:49:41 +0200 |
commit | 33c41876edbb8e63b2f6633db894726f48044932 (patch) | |
tree | 54ce9550d739b5acb28015b98c66aa19385e350a /apps | |
parent | evp_generic_fetch.pod: fix documentation error (diff) | |
download | openssl-33c41876edbb8e63b2f6633db894726f48044932.tar.xz openssl-33c41876edbb8e63b2f6633db894726f48044932.zip |
apps/cmp.c: Fix memory leaks in handle_opt_geninfo() found by Coverity
CID 1463578: Resource leaks (RESOURCE_LEAK)
CID 1463575: Resource leaks (RESOURCE_LEAK)
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12231)
Diffstat (limited to 'apps')
-rw-r--r-- | apps/cmp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/apps/cmp.c b/apps/cmp.c index 05fae77d38..638005b4fc 100644 --- a/apps/cmp.c +++ b/apps/cmp.c @@ -2042,12 +2042,11 @@ static int handle_opt_geninfo(OSSL_CMP_CTX *ctx) return 0; } - aint = ASN1_INTEGER_new(); - if (aint == NULL || !ASN1_INTEGER_set(aint, value)) + if ((aint = ASN1_INTEGER_new()) == NULL) goto oom; val = ASN1_TYPE_new(); - if (val == NULL) { + if (!ASN1_INTEGER_set(aint, value) || val == NULL) { ASN1_INTEGER_free(aint); goto oom; } @@ -2065,6 +2064,7 @@ static int handle_opt_geninfo(OSSL_CMP_CTX *ctx) return 1; oom: + ASN1_OBJECT_free(type); CMP_err("out of memory"); return 0; } |