From f3a559b3c2bfef2d956b0f123ce2a6a57c0b3767 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Thu, 28 Jan 2010 15:06:42 -0800 Subject: [PATCH] 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 --- kdc/headers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kdc/headers.h b/kdc/headers.h index 1eb3ddedc..aced5ce61 100644 --- a/kdc/headers.h +++ b/kdc/headers.h @@ -107,7 +107,7 @@ #include #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)