Skip to content

Commit

Permalink
fixup! Free data if sk_OPENSSL_STRING_push fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
fwh-dc committed Dec 30, 2024
1 parent 187cb0e commit 7081528
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crypto/x509/by_store.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static int by_store_ctrl_ex(X509_LOOKUP *ctx, int cmd, const char *argp,
uris = sk_OPENSSL_STRING_new_null();
X509_LOOKUP_set_method_data(ctx, uris);
}
if (!sk_OPENSSL_STRING_push(uris, data)) {
if (sk_OPENSSL_STRING_push(uris, data) <= 0) {
OPENSSL_free(data);
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion test/evp_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ static int ctrladd(STACK_OF(OPENSSL_STRING) *controls, const char *value)
if (data == NULL)
return -1;

if (!sk_OPENSSL_STRING_push(controls, data)) {
if (sk_OPENSSL_STRING_push(controls, data) <= 0) {
OPENSSL_free(data);
return -1;
}
Expand Down

0 comments on commit 7081528

Please sign in to comment.