diff options
author | Tomas Mraz <tomas@openssl.org> | 2024-04-11 09:40:18 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2024-04-12 10:56:28 +0200 |
commit | 682ed1b86ebe97036ab37897d528343d0e4def69 (patch) | |
tree | 63b997a13acf10dcdd5aae2142817bbb2a35573f | |
parent | 8e5918fb8eb90289a0c89f6a4c6d623ecf49cf43 (diff) |
make_addressPrefix(): Fix a memory leak in error case
Fixes #24098
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24102)
-rw-r--r-- | crypto/x509/v3_addr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/x509/v3_addr.c b/crypto/x509/v3_addr.c index a37d4f2b91..d0e5f9efe6 100644 --- a/crypto/x509/v3_addr.c +++ b/crypto/x509/v3_addr.c @@ -407,11 +407,11 @@ static int make_addressPrefix(IPAddressOrRange **result, unsigned char *addr, const int prefixlen, const int afilen) { int bytelen = (prefixlen + 7) / 8, bitlen = prefixlen % 8; - IPAddressOrRange *aor = IPAddressOrRange_new(); + IPAddressOrRange *aor; if (prefixlen < 0 || prefixlen > (afilen * 8)) return 0; - if (aor == NULL) + if ((aor = IPAddressOrRange_new()) == NULL) return 0; aor->type = IPAddressOrRange_addressPrefix; if (aor->u.addressPrefix == NULL && |