mirror of
https://github.com/openssl/openssl.git
synced 2025-04-06 20:20:50 +08:00
Avoid memory leak of parent on allocation failure for child structure
Reviewed-by: Ben Kaduk <kaduk@mit.edu> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13055)
This commit is contained in:
parent
8ad369171f
commit
a21db568bf
@ -647,9 +647,11 @@ int cms_main(int argc, char **argv)
|
||||
if (key_param == NULL || key_param->idx != keyidx) {
|
||||
cms_key_param *nparam;
|
||||
nparam = app_malloc(sizeof(*nparam), "key param buffer");
|
||||
nparam->idx = keyidx;
|
||||
if ((nparam->param = sk_OPENSSL_STRING_new_null()) == NULL)
|
||||
if ((nparam->param = sk_OPENSSL_STRING_new_null()) == NULL) {
|
||||
OPENSSL_free(nparam);
|
||||
goto end;
|
||||
}
|
||||
nparam->idx = keyidx;
|
||||
nparam->next = NULL;
|
||||
if (key_first == NULL)
|
||||
key_first = nparam;
|
||||
|
Loading…
x
Reference in New Issue
Block a user