Skip to content

Commit

Permalink
CID 426426 code maintainability warning, stored NULL value overwritte…
Browse files Browse the repository at this point in the history
…n before used
  • Loading branch information
JacobBarthelmeh committed Oct 24, 2024
1 parent 077b070 commit 52ba700
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/x509_str.c
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,7 @@ WOLF_STACK_OF(WOLFSSL_X509_OBJECT)* wolfSSL_X509_STORE_get0_objects(
* simplify cleanup logic handling cert merging above */
for (i = 0; i < wolfSSL_sk_X509_num(cert_stack); i++) {
x509 = (WOLFSSL_X509 *)wolfSSL_sk_value(cert_stack, i);
obj = wolfSSL_X509_OBJECT_new();
obj = wolfSSL_X509_OBJECT_new();
if (obj == NULL) {
WOLFSSL_MSG("wolfSSL_X509_OBJECT_new error");
goto err_cleanup;
Expand All @@ -1766,10 +1766,9 @@ WOLF_STACK_OF(WOLFSSL_X509_OBJECT)* wolfSSL_X509_STORE_get0_objects(
}
obj->type = WOLFSSL_X509_LU_X509;
obj->data.x509 = x509;
x509 = NULL;
}

while(wolfSSL_sk_X509_num(cert_stack) > 0) {
while (wolfSSL_sk_X509_num(cert_stack) > 0) {
wolfSSL_sk_X509_pop(cert_stack);
}
#endif
Expand Down Expand Up @@ -1799,7 +1798,7 @@ WOLF_STACK_OF(WOLFSSL_X509_OBJECT)* wolfSSL_X509_STORE_get0_objects(
if (ret != NULL)
X509StoreFreeObjList(store, ret);
if (cert_stack != NULL) {
while(store->numAdded > 0) {
while (store->numAdded > 0) {
wolfSSL_sk_X509_pop(cert_stack);
store->numAdded--;
}
Expand Down

0 comments on commit 52ba700

Please sign in to comment.