summaryrefslogtreecommitdiffstats
path: root/apps/cms.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-04-27 14:46:09 +0100
committerMatt Caswell <matt@openssl.org>2016-06-01 18:00:53 +0100
commit6e4ab54b93a161bed3d668315b13359b883caca4 (patch)
treefaff5da619cf71063682925de6866879a52a6d7b /apps/cms.c
parent0e9eb1a57bd2e12eda7939f053240499f6169d74 (diff)
Free memory on error in cms app
The make_receipt_request() function in the cms app can leak memory on an error condition. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'apps/cms.c')
-rw-r--r--apps/cms.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/apps/cms.c b/apps/cms.c
index 3a9b7af7b9..ad771d2d85 100644
--- a/apps/cms.c
+++ b/apps/cms.c
@@ -1240,7 +1240,7 @@ static CMS_ReceiptRequest *make_receipt_request(STACK_OF(OPENSSL_STRING)
*rr_to, int rr_allorfirst, STACK_OF(OPENSSL_STRING)
*rr_from)
{
- STACK_OF(GENERAL_NAMES) *rct_to, *rct_from;
+ STACK_OF(GENERAL_NAMES) *rct_to = NULL, *rct_from = NULL;
CMS_ReceiptRequest *rr;
rct_to = make_names_stack(rr_to);
if (!rct_to)
@@ -1255,6 +1255,7 @@ static CMS_ReceiptRequest *make_receipt_request(STACK_OF(OPENSSL_STRING)
rct_to);
return rr;
err:
+ sk_GENERAL_NAMES_pop_free(rct_to, GENERAL_NAMES_free);
return NULL;
}