diff options
author | Amar Tumballi <amar@gluster.com> | 2009-07-17 22:41:44 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-07-20 14:28:53 -0700 |
commit | 632cce5e720acaa28ab680a6850f2aa8289d4628 (patch) | |
tree | 8cdc8afe41411ecde9c7a80b49162088bb09e08e /libglusterfs/src/inode.c | |
parent | 5be3c142978257032bd11ad420382859fc204702 (diff) |
fix build warnings in 'libglusterfs/'
return value of 'asprintf' was not checked, and the flow was
continuing without returning error, which could cause potential
segfaults in code (mostly possible during ENOMEM case).
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 130 (build warnings)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=130
Diffstat (limited to 'libglusterfs/src/inode.c')
-rw-r--r-- | libglusterfs/src/inode.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index 858f7e14d93..9796071d87e 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -968,9 +968,9 @@ inode_table_t * inode_table_new (size_t lru_limit, xlator_t *xl) { inode_table_t *new = NULL; + int ret = 0; int i = 0; - new = (void *)calloc (1, sizeof (*new)); if (!new) return NULL; @@ -1009,7 +1009,11 @@ inode_table_new (size_t lru_limit, xlator_t *xl) INIT_LIST_HEAD (&new->lru); INIT_LIST_HEAD (&new->purge); - asprintf (&new->name, "%s/inode", xl->name); + ret = asprintf (&new->name, "%s/inode", xl->name); + if (-1 == ret) { + /* TODO: This should be ok to continue, check with avati */ + ; + } __inode_table_init_root (new); |