From fce8bc76bd976e2e2d08d530a462b2c8c73da020 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Tue, 23 Jun 2020 08:17:55 +0200 Subject: added memset to avoid uninit. mem in tree_insert() --- src/tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/tree.c b/src/tree.c index 5706c4c..479e2a6 100644 --- a/src/tree.c +++ b/src/tree.c @@ -25,7 +25,8 @@ int tree_insert ( struct tree_node** _root, char* _key, void* _data ) *node = malloc (sizeof(typeof(**node))); if( ! *node ) - return 1; + return 2; + memset ( *node, 0, sizeof(typeof(**node)) ); (*node)->key = _key; (*node)->data = _data; -- cgit v1.2.3