Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

Commit

Permalink
btree: memset new nodes to 0
Browse files Browse the repository at this point in the history
When making a new node, make sure that all its members are initialized
to zero.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
  • Loading branch information
artagnon committed Aug 29, 2012
1 parent 5d2681a commit 611a8da
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion btree.c
Expand Up @@ -45,7 +45,7 @@
// #define WINDOWS
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>

// GLOBALS.

Expand Down Expand Up @@ -337,6 +337,7 @@ node *make_node(void)
{
node *new_node;
new_node = malloc(sizeof(node));
memset(new_node, 0, sizeof(node));
if (new_node == NULL) {
perror("Node creation.");
exit(EXIT_FAILURE);
Expand Down

0 comments on commit 611a8da

Please sign in to comment.