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:57:16 +0200 |
commit | bfa293cd2ac93d69f2bbd4e0546bb02a93eb8806 (patch) | |
tree | cf1df113ca9c6a04d9a4e2fe56cba77025c6ad4f /crypto | |
parent | 6637d7dfad51eb593eb0ba4ecce2adbac6ebcbec (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)
(cherry picked from commit 682ed1b86ebe97036ab37897d528343d0e4def69)
Diffstat (limited to 'crypto')
-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 && |