Ensure data structures allocated by hprop are initialized
Use calloc instead of malloc when allocating data structures while importing a dump in hprop. Fixes a crash in hprop when reading MIT dump files due unintialized memory in the Salt data structure, plus will be more robust against any future changes to the data model. Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
This commit is contained in:

committed by
Love Hornquist Astrand

parent
04d3215d39
commit
f3a559b3c2
@@ -107,7 +107,7 @@
|
||||
#include <windc_plugin.h>
|
||||
|
||||
#undef ALLOC
|
||||
#define ALLOC(X) ((X) = malloc(sizeof(*(X))))
|
||||
#define ALLOC(X) ((X) = calloc(1, sizeof(*(X))))
|
||||
#undef ALLOC_SEQ
|
||||
#define ALLOC_SEQ(X, N) do { (X)->len = (N); \
|
||||
(X)->val = calloc((X)->len, sizeof(*(X)->val)); } while(0)
|
||||
|
Reference in New Issue
Block a user