summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/inode.c
diff options
context:
space:
mode:
authorPoornima G <pgurusid@redhat.com>2014-02-28 12:13:55 +0530
committerAnand Avati <avati@redhat.com>2014-03-01 19:04:00 -0800
commit9f45d0f6212d6d5c96dafc4aba73d9d12b39c3d6 (patch)
treea28c29b92ee8a4f083b71e91c014ef92b79bf021 /libglusterfs/src/inode.c
parent7b3399cd462d0fca6509168f13a67f43e8b2c7d2 (diff)
libglusterfs/inode: Fix NULL dereferences.
There could be scenarios where the inode_ctx_get() can be called to only check if the context exists, in such cases the buffer for the context might not have been passed. Hence fix inode_ctx_get() to not crash, when the buffer is not passed. Change-Id: I607d86eb401ccab0e5cd75f6f977c454994ec063 BUG: 789278 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/7167 Reviewed-by: Santosh Pradhan <spradhan@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs/src/inode.c')
-rw-r--r--libglusterfs/src/inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index 15e0ccf788b..d4eade8ba88 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -1599,7 +1599,7 @@ __inode_ctx_get0 (inode_t *inode, xlator_t *xlator, uint64_t *value1)
int ret = 0;
ret = __inode_ctx_get2 (inode, xlator, &tmp_value, NULL);
- if (!ret)
+ if (!ret && value1)
*value1 = tmp_value;
return ret;
@@ -1612,7 +1612,7 @@ __inode_ctx_get1 (inode_t *inode, xlator_t *xlator, uint64_t *value2)
int ret = 0;
ret = __inode_ctx_get2 (inode, xlator, NULL, &tmp_value);
- if (!ret)
+ if (!ret && value2)
*value2 = tmp_value;
return ret;