Skip to content

Commit 92952a5

Browse files
authored
Merge pull request #7839 from bandi13/noIfXFREE
No if xfree
2 parents 632d965 + 38d191c commit 92952a5

91 files changed

Lines changed: 1813 additions & 3794 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

IDE/CRYPTOCELL/user_settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ extern "C" {
401401

402402
/* prototypes for user heap override functions */
403403
/* Note: Realloc only required for normal math */
404+
/* Note2: XFREE(NULL) must be properly handled */
404405
#include <stddef.h> /* for size_t */
405406
extern void *myMalloc(size_t n, void* heap, int type);
406407
extern void myFree(void *p, void* heap, int type);

IDE/GCC-ARM/Header/user_settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ extern "C" {
419419

420420
/* prototypes for user heap override functions */
421421
/* Note: Realloc only required for normal math */
422+
/* Note2: XFREE(NULL) must be properly handled */
422423
#include <stddef.h> /* for size_t */
423424
extern void *myMalloc(size_t n, void* heap, int type);
424425
extern void myFree(void *p, void* heap, int type);

IDE/NETOS/user_settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ extern "C" {
410410

411411
/* prototypes for user heap override functions */
412412
/* Note: Realloc only required for normal math */
413+
/* Note2: XFREE(NULL) must be properly handled */
413414
#include <stddef.h> /* for size_t */
414415
extern void *myMalloc(size_t n, void* heap, int type);
415416
extern void myFree(void *p, void* heap, int type);

IDE/RISCV/SIFIVE-HIFIVE1/user_settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ extern "C" {
397397

398398
/* prototypes for user heap override functions */
399399
/* Note: Realloc only required for normal math */
400+
/* Note2: XFREE(NULL) must be properly handled */
400401
#include <stddef.h> /* for size_t */
401402
extern void *myMalloc(size_t n, void* heap, int type);
402403
extern void myFree(void *p, void* heap, int type);

IDE/Renesas/e2studio/RA6M4/test/src/test_main.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,11 @@ void Clr_CallbackCtx(FSPSM_ST *g)
151151
(void) g;
152152

153153
#if defined(WOLFSSL_RENESAS_SCEPROTECT_CRYPTONLY)
154-
if (g->wrapped_key_rsapri2048 != NULL)
155-
XFREE(g->wrapped_key_rsapri2048,
156-
NULL, DYNAMIC_TYPE_TMP_BUFFER);
154+
XFREE(g->wrapped_key_rsapri2048, NULL, DYNAMIC_TYPE_TMP_BUFFER);
157155

158-
if (g->wrapped_key_rsapub2048 != NULL)
159-
XFREE(g->wrapped_key_rsapub2048,
160-
NULL, DYNAMIC_TYPE_TMP_BUFFER);
156+
XFREE(g->wrapped_key_rsapub2048, NULL, DYNAMIC_TYPE_TMP_BUFFER);
161157

162-
if (g->wrapped_key_rsapri1024 != NULL)
163-
XFREE(g->wrapped_key_rsapri1024,
164-
NULL, DYNAMIC_TYPE_TMP_BUFFER);
158+
XFREE(g->wrapped_key_rsapri1024, NULL, DYNAMIC_TYPE_TMP_BUFFER);
165159

166160
if (g->wrapped_key_rsapub2048 != NULL)
167161
XFREE(g->wrapped_key_rsapub1024,

IDE/Renesas/e2studio/RA6M4/test/src/wolfssl_sce_unit_test.c

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -691,18 +691,10 @@ static int sce_rsa_test(int prnt, int keySize)
691691
wc_FreeRsaKey(key);
692692
XFREE(key, NULL, DYNAMIC_TYPE_TMP_BUFFER);
693693
}
694-
if (in != NULL) {
695-
XFREE(in, NULL, DYNAMIC_TYPE_TMP_BUFFER);
696-
}
697-
if (in2 != NULL) {
698-
XFREE(in2, NULL, DYNAMIC_TYPE_TMP_BUFFER);
699-
}
700-
if (out != NULL) {
701-
XFREE(out, NULL, DYNAMIC_TYPE_TMP_BUFFER);
702-
}
703-
if (out2 != NULL) {
704-
XFREE(out2, NULL, DYNAMIC_TYPE_TMP_BUFFER);
705-
}
694+
XFREE(in, NULL, DYNAMIC_TYPE_TMP_BUFFER);
695+
XFREE(in2, NULL, DYNAMIC_TYPE_TMP_BUFFER);
696+
XFREE(out, NULL, DYNAMIC_TYPE_TMP_BUFFER);
697+
XFREE(out2, NULL, DYNAMIC_TYPE_TMP_BUFFER);
706698

707699
return ret;
708700
}
@@ -778,15 +770,9 @@ static int sce_rsa_SignVerify_test(int prnt, int keySize)
778770
wc_FreeRsaKey(key);
779771
XFREE(key, NULL, DYNAMIC_TYPE_TMP_BUFFER);
780772
}
781-
if (in != NULL) {
782-
XFREE(in, NULL, DYNAMIC_TYPE_TMP_BUFFER);
783-
}
784-
if (in2 != NULL) {
785-
XFREE(in2, NULL, DYNAMIC_TYPE_TMP_BUFFER);
786-
}
787-
if (out != NULL) {
788-
XFREE(out, NULL, DYNAMIC_TYPE_TMP_BUFFER);
789-
}
773+
XFREE(in, NULL, DYNAMIC_TYPE_TMP_BUFFER);
774+
XFREE(in2, NULL, DYNAMIC_TYPE_TMP_BUFFER);
775+
XFREE(out, NULL, DYNAMIC_TYPE_TMP_BUFFER);
790776

791777
return ret;
792778
}

IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_tsip_unit_test.c

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -107,21 +107,13 @@ typedef struct tagInfo
107107

108108
void Clr_CallbackCtx(TsipUserCtx *g)
109109
{
110-
if (g->rsa1024pri_keyIdx != NULL)
111-
XFREE(g->rsa1024pri_keyIdx,
112-
NULL, DYNAMIC_TYPE_TMP_BUFFER);
110+
XFREE(g->rsa1024pri_keyIdx, NULL, DYNAMIC_TYPE_TMP_BUFFER);
113111

114-
if (g->rsa1024pub_keyIdx != NULL)
115-
XFREE(g->rsa1024pub_keyIdx,
116-
NULL, DYNAMIC_TYPE_TMP_BUFFER);
112+
XFREE(g->rsa1024pub_keyIdx, NULL, DYNAMIC_TYPE_TMP_BUFFER);
117113

118-
if (g->rsa2048pri_keyIdx != NULL)
119-
XFREE(g->rsa2048pri_keyIdx,
120-
NULL, DYNAMIC_TYPE_TMP_BUFFER);
114+
XFREE(g->rsa2048pri_keyIdx, NULL, DYNAMIC_TYPE_TMP_BUFFER);
121115

122-
if (g->rsa2048pub_keyIdx != NULL)
123-
XFREE(g->rsa2048pub_keyIdx,
124-
NULL, DYNAMIC_TYPE_TMP_BUFFER);
116+
XFREE(g->rsa2048pub_keyIdx, NULL, DYNAMIC_TYPE_TMP_BUFFER);
125117
XMEMSET(g, 0, sizeof(TsipUserCtx));
126118
}
127119

@@ -789,15 +781,9 @@ static int tsip_rsa_SignVerify_test(int prnt, int keySize)
789781
wc_FreeRsaKey(key);
790782
XFREE(key, NULL, DYNAMIC_TYPE_TMP_BUFFER);
791783
}
792-
if (in != NULL) {
793-
XFREE(in, NULL, DYNAMIC_TYPE_TMP_BUFFER);
794-
}
795-
if (in2 != NULL) {
796-
XFREE(in2, NULL, DYNAMIC_TYPE_TMP_BUFFER);
797-
}
798-
if (out != NULL) {
799-
XFREE(out, NULL, DYNAMIC_TYPE_TMP_BUFFER);
800-
}
784+
XFREE(in, NULL, DYNAMIC_TYPE_TMP_BUFFER);
785+
XFREE(in2, NULL, DYNAMIC_TYPE_TMP_BUFFER);
786+
XFREE(out, NULL, DYNAMIC_TYPE_TMP_BUFFER);
801787

802788
return ret;
803789
}

IDE/Renesas/e2studio/RZN2L/test/src/test/wolfssl_rsip_unit_test.c

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -718,18 +718,10 @@ static int rsip_rsa_test(int prnt, int keySize)
718718
wc_FreeRsaKey(key);
719719
XFREE(key, NULL, DYNAMIC_TYPE_TMP_BUFFER);
720720
}
721-
if (in != NULL) {
722-
XFREE(in, NULL, DYNAMIC_TYPE_TMP_BUFFER);
723-
}
724-
if (in2 != NULL) {
725-
XFREE(in2, NULL, DYNAMIC_TYPE_TMP_BUFFER);
726-
}
727-
if (out != NULL) {
728-
XFREE(out, NULL, DYNAMIC_TYPE_TMP_BUFFER);
729-
}
730-
if (out2 != NULL) {
731-
XFREE(out2, NULL, DYNAMIC_TYPE_TMP_BUFFER);
732-
}
721+
XFREE(in, NULL, DYNAMIC_TYPE_TMP_BUFFER);
722+
XFREE(in2, NULL, DYNAMIC_TYPE_TMP_BUFFER);
723+
XFREE(out, NULL, DYNAMIC_TYPE_TMP_BUFFER);
724+
XFREE(out2, NULL, DYNAMIC_TYPE_TMP_BUFFER);
733725

734726
(void) prnt;
735727
return ret;
@@ -808,15 +800,9 @@ static int rsip_rsa_SignVerify_test(int prnt, int keySize)
808800
wc_FreeRsaKey(key);
809801
XFREE(key, NULL, DYNAMIC_TYPE_TMP_BUFFER);
810802
}
811-
if (in != NULL) {
812-
XFREE(in, NULL, DYNAMIC_TYPE_TMP_BUFFER);
813-
}
814-
if (in2 != NULL) {
815-
XFREE(in2, NULL, DYNAMIC_TYPE_TMP_BUFFER);
816-
}
817-
if (out != NULL) {
818-
XFREE(out, NULL, DYNAMIC_TYPE_TMP_BUFFER);
819-
}
803+
XFREE(in, NULL, DYNAMIC_TYPE_TMP_BUFFER);
804+
XFREE(in2, NULL, DYNAMIC_TYPE_TMP_BUFFER);
805+
XFREE(out, NULL, DYNAMIC_TYPE_TMP_BUFFER);
820806

821807
return ret;
822808
}

IDE/STARCORE/user_settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ extern "C" {
417417

418418
/* prototypes for user heap override functions */
419419
/* Note: Realloc only required for normal math */
420+
/* Note2: XFREE(NULL) must be properly handled */
420421
#include <stddef.h> /* for size_t */
421422
extern void *myMalloc(size_t n, void* heap, int type);
422423
extern void myFree(void *p, void* heap, int type);

IDE/STM32Cube/wolfssl_example.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,9 +1700,7 @@ static int tls13_uart_server(void)
17001700
}
17011701

17021702
#ifdef WOLFSSL_SMALL_STACK
1703-
if (tbuf != NULL) {
1704-
XFREE(tbuf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
1705-
}
1703+
XFREE(tbuf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
17061704
#endif
17071705

17081706
return ret;
@@ -1795,9 +1793,7 @@ static int tls13_uart_client(void)
17951793
wolfSSL_CTX_free(ctx);
17961794
}
17971795
#ifdef WOLFSSL_SMALL_STACK
1798-
if (tbuf != NULL) {
1799-
XFREE(tbuf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
1800-
}
1796+
XFREE(tbuf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
18011797
#endif
18021798

18031799
return ret;

0 commit comments

Comments
 (0)