diff --git a/doc/Changelog b/doc/Changelog index cbcb2cb6f..eb30d8d34 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -2,6 +2,7 @@ - Remove ECS option after REFUSED answer. - Fix small memory leak in edns_opt_copy_alloc. - Respip dereference after NULL check. + - Zero initialize addrtree allocation. 7 April 2017: George - Fix pythonmod for cb changes. diff --git a/edns-subnet/addrtree.c b/edns-subnet/addrtree.c index 948c4f58a..69ace6054 100644 --- a/edns-subnet/addrtree.c +++ b/edns-subnet/addrtree.c @@ -124,7 +124,7 @@ addrtree_create(addrlen_t max_depth, void (*delfunc)(void *, void *), struct addrtree *tree; log_assert(delfunc != NULL); log_assert(sizefunc != NULL); - tree = (struct addrtree *)malloc( sizeof (*tree) ); + tree = (struct addrtree *)calloc(1, sizeof(*tree)); if (!tree) return NULL; tree->root = node_create(tree, NULL, 0, 0);