summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPino Toscano <toscano.pino@tiscali.it>2013-03-21 16:09:34 +0100
committerPino Toscano <toscano.pino@tiscali.it>2013-03-21 16:09:34 +0100
commit8bb3547d7c2e47a88006a2da9c82655efb5f950e (patch)
tree182b27d2387d487c9f3f2803a9e6a04d57a118b2
parent224fb18144e9eebd7ab3418601a6cfdba62ca051 (diff)
Initialize correctly new netnode instances
A couple of variables were left uninitialized, leading to unlink (wrongly) nodes. Switch to calloc to make sure everything is properly reset. * src/netnode.c (fuse_make_netnode): Use calloc instead of malloc.
-rw-r--r--src/netnode.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/netnode.c b/src/netnode.c
index cfbd8cd01..de2ffecb1 100644
--- a/src/netnode.c
+++ b/src/netnode.c
@@ -87,13 +87,12 @@ fuse_make_netnode(struct netnode *parent, const char *path)
pthread_rwlock_unlock(&fuse_netnodes_lock);
DEBUG("netnodes_lock", "releasing pthread_rwlock_rdlock.\n");
- nn = malloc(sizeof(*nn));
+ nn = calloc(1, sizeof(*nn));
if(! nn)
return NULL; /* unfortunately we cannot serve a netnode .... */
nn->path = strdup(path);
nn->parent = parent;
- nn->node = NULL;
pthread_mutex_init(&nn->lock, NULL);
DEBUG("netnodes_lock", "aquiring pthread_rwlock_wrlock for %s.\n", path);