Skip to content

Commit

Permalink
Fix a similar memory leak in SXNET_add_id_INTEGER
Browse files Browse the repository at this point in the history
Even in the good case there was memory leak here.
Add a simple test case to have at least some test coverage.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #23234)

(cherry picked from commit 3980118)
  • Loading branch information
bernd-edlinger authored and t8m committed Jan 10, 2024
1 parent 47ca80d commit 490dfc0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions crypto/x509/v3_sxnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *zone, const char *user,
ERR_raise(ERR_LIB_X509V3, ERR_R_CRYPTO_LIB);
goto err;
}
ASN1_INTEGER_free(id->zone);
id->zone = zone;
*psx = sx;
return 1;
Expand Down
3 changes: 2 additions & 1 deletion test/recipes/25-test_req.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use OpenSSL::Test qw/:DEFAULT srctop_file/;

setup("test_req");

plan tests => 106;
plan tests => 107;

require_ok(srctop_file('test', 'recipes', 'tconversion.pl'));

Expand Down Expand Up @@ -52,6 +52,7 @@ ok(!run(app([@addext_args, "-addext", $val, "-addext", $val])));
ok(!run(app([@addext_args, "-addext", $val, "-addext", $val2])));
ok(!run(app([@addext_args, "-addext", $val, "-addext", $val3])));
ok(!run(app([@addext_args, "-addext", $val2, "-addext", $val3])));
ok(run(app([@addext_args, "-addext", "SXNetID=1:one, 2:two, 3:three"])));

# If a CSR is provided with neither of -key or -CA/-CAkey, this should fail.
ok(!run(app(["openssl", "req", "-x509",
Expand Down

0 comments on commit 490dfc0

Please sign in to comment.