From b83aebafb1697ca1c882cd326dd87cfbd8abfc1f Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Thu, 22 Aug 2019 11:49:10 -0600 Subject: [PATCH] help out static analysis tool --- wolfcrypt/src/pkcs12.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wolfcrypt/src/pkcs12.c b/wolfcrypt/src/pkcs12.c index 399b2a7ad..c221f7b22 100644 --- a/wolfcrypt/src/pkcs12.c +++ b/wolfcrypt/src/pkcs12.c @@ -784,9 +784,6 @@ int wc_i2d_PKCS12(WC_PKCS12* pkcs12, byte** der, int* derSz) if (*der == NULL) { /* Allocate if requested */ buf = (byte*)XMALLOC(totalSz, NULL, DYNAMIC_TYPE_PKCS); - if (buf == NULL) { - ret = MEMORY_E; - } } else { buf = *der; @@ -802,6 +799,10 @@ int wc_i2d_PKCS12(WC_PKCS12* pkcs12, byte** der, int* derSz) } } + if (buf == NULL) { + ret = MEMORY_E; + } + if (ret == 0) { idx = 0;