Add xallocarray() helper macro
Uses reallocarray to perform integer overflow detection when allocating an array, using NULL as the previous pointer to force a new allocation. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
parent
0887c9463f
commit
c213b29d14
|
@ -74,6 +74,8 @@ typedef struct _NewClientRec *NewClientPtr;
|
|||
|
||||
#define xstrdup(s) Xstrdup(s)
|
||||
#define xnfstrdup(s) XNFstrdup(s)
|
||||
|
||||
#define xallocarray(num, size) reallocarray(NULL, (num), (size))
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
Loading…
Reference in New Issue
Block a user