Skip to content

Commit 498115f

Browse files
committed
Zero out allocated buffers
1 parent ac4d7b0 commit 498115f

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Source/heap_5.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
*
111111
*/
112112
#include <stdlib.h>
113+
#include <string.h>
113114

114115
/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
115116
all the API functions to use the MPU wrappers. That should only be done when
@@ -312,6 +313,12 @@ void *pvReturn = NULL;
312313
}
313314
#endif
314315

316+
/*
317+
* Zero out returned block
318+
*/
319+
if (pvReturn != NULL)
320+
memset((void*)pvReturn, 0, xWantedSize - uxHeapStructSize);
321+
315322
return pvReturn;
316323
}
317324
/*-----------------------------------------------------------*/

0 commit comments

Comments
 (0)