diff options
| -rw-r--r-- | libcnary/node.c | 5 | ||||
| -rw-r--r-- | libcnary/node_list.c | 5 | ||||
| -rw-r--r-- | src/xplist.c | 3 | ||||
| -rw-r--r-- | tools/plistutil.c | 3 |
4 files changed, 6 insertions, 10 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) { | |||
| 46 | node_t* node_create(node_t* parent, void* data) { | 46 | node_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 | ||
| 35 | node_list_t* node_list_create() { | 35 | node_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; |
diff --git a/src/xplist.c b/src/xplist.c index 3a92142..2f98983 100644 --- a/src/xplist.c +++ b/src/xplist.c | |||
| @@ -211,8 +211,7 @@ static void node_to_xml(node_t* node, bytearray_t **outbuf, uint32_t depth) | |||
| 211 | struct TM _btime; | 211 | struct TM _btime; |
| 212 | struct TM *btime = gmtime64_r(&timev, &_btime); | 212 | struct TM *btime = gmtime64_r(&timev, &_btime); |
| 213 | if (btime) { | 213 | if (btime) { |
| 214 | val = (char*)malloc(24); | 214 | val = (char*)calloc(1, 24); |
| 215 | memset(val, 0, 24); | ||
| 216 | struct tm _tmcopy; | 215 | struct tm _tmcopy; |
| 217 | copy_TM64_to_tm(btime, &_tmcopy); | 216 | copy_TM64_to_tm(btime, &_tmcopy); |
| 218 | val_len = strftime(val, 24, "%Y-%m-%dT%H:%M:%SZ", &_tmcopy); | 217 | val_len = strftime(val, 24, "%Y-%m-%dT%H:%M:%SZ", &_tmcopy); |
diff --git a/tools/plistutil.c b/tools/plistutil.c index 989db35..fd0847b 100644 --- a/tools/plistutil.c +++ b/tools/plistutil.c | |||
| @@ -69,8 +69,7 @@ static options_t *parse_arguments(int argc, char *argv[]) | |||
| 69 | { | 69 | { |
| 70 | int i = 0; | 70 | int i = 0; |
| 71 | 71 | ||
| 72 | options_t *options = (options_t *) malloc(sizeof(options_t)); | 72 | options_t *options = (options_t*)calloc(1, sizeof(options_t)); |
| 73 | memset(options, 0, sizeof(options_t)); | ||
| 74 | options->out_fmt = 0; | 73 | options->out_fmt = 0; |
| 75 | 74 | ||
| 76 | for (i = 1; i < argc; i++) | 75 | for (i = 1; i < argc; i++) |
