summaryrefslogtreecommitdiffstats
path: root/libcnary
diff options
context:
space:
mode:
Diffstat (limited to 'libcnary')
-rw-r--r--libcnary/node.c5
-rw-r--r--libcnary/node_list.c5
2 files changed, 4 insertions, 6 deletions
diff --git a/libcnary/node.c b/libcnary/node.c
index c24ca7a..6d68f6e 100644
--- a/libcnary/node.c
+++ b/libcnary/node.c
@@ -46,11 +46,10 @@ void node_destroy(node_t* node) {
46node_t* node_create(node_t* parent, void* data) { 46node_t* node_create(node_t* parent, void* data) {
47 int error = 0; 47 int error = 0;
48 48
49 node_t* node = (node_t*) malloc(sizeof(node_t)); 49 node_t* node = (node_t*)calloc(1, sizeof(node_t));
50 if(node == NULL) { 50 if (node == NULL) {
51 return NULL; 51 return NULL;
52 } 52 }
53 memset(node, '\0', sizeof(node_t));
54 53
55 node->data = data; 54 node->data = data;
56 node->next = NULL; 55 node->next = NULL;
diff --git a/libcnary/node_list.c b/libcnary/node_list.c
index d071881..aee3bd6 100644
--- a/libcnary/node_list.c
+++ b/libcnary/node_list.c
@@ -33,11 +33,10 @@ void node_list_destroy(node_list_t* list) {
33} 33}
34 34
35node_list_t* node_list_create() { 35node_list_t* node_list_create() {
36 node_list_t* list = (node_list_t*) malloc(sizeof(node_list_t)); 36 node_list_t* list = (node_list_t*)calloc(1, sizeof(node_list_t));
37 if(list == NULL) { 37 if (list == NULL) {
38 return NULL; 38 return NULL;
39 } 39 }
40 memset(list, '\0', sizeof(node_list_t));
41 40
42 // Initialize structure 41 // Initialize structure
43 list->begin = NULL; 42 list->begin = NULL;