Skip to content

Commit 3b68026

Browse files
authored
Merge pull request #9907 from julek-wolfssl/fenrir/202
wolfSSL_X509_set_ext: fix memory handling
2 parents 4e4215a + 49039ef commit 3b68026

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/x509.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,15 +1086,15 @@ WOLFSSL_X509_EXTENSION* wolfSSL_X509_set_ext(WOLFSSL_X509* x509, int loc)
10861086
XFREE((byte*)ext->obj->obj, NULL, DYNAMIC_TYPE_ASN1);
10871087
}
10881088
else if (tmp == NULL) {
1089-
ext->obj->obj = tmp;
1089+
XFREE((byte*)ext->obj->obj, NULL, DYNAMIC_TYPE_ASN1);
10901090
}
10911091
ext->obj->obj = tmp;
10921092
#else
10931093
tmp = (byte*)XREALLOC((byte*)ext->obj->obj, objSz, NULL,
10941094
DYNAMIC_TYPE_ASN1);
1095-
if (tmp != NULL) {
1096-
ext->obj->obj = tmp;
1097-
}
1095+
if (tmp == NULL)
1096+
XFREE((byte*)ext->obj->obj, NULL, DYNAMIC_TYPE_ASN1);
1097+
ext->obj->obj = tmp;
10981098
#endif
10991099
if (ext->obj->obj == NULL) {
11001100
wolfSSL_X509_EXTENSION_free(ext);

0 commit comments

Comments
 (0)