summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorPrashanth Pai <ppai@redhat.com>2015-02-24 16:48:20 +0530
committerNiels de Vos <ndevos@redhat.com>2015-03-08 10:02:14 -0700
commit9b3c799fa3a5535e189d18200324d912339ac6a6 (patch)
treef0d3c9e5c23c9c1c1f83798c58ac93c55bf60dd4 /api
parenta25cdf135f01ebeb64a4497df1bb5146bfdc6620 (diff)
gfapi: Add NULL check for volname in glfs_new()
BUG: 1199388 Change-Id: I66cb65355504eb47e4392576029a9a5422996a1b Signed-off-by: Prashanth Pai <ppai@redhat.com> Reviewed-on: http://review.gluster.org/9735 Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'api')
-rw-r--r--api/src/glfs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c
index 7d493720121..df8adb6faf5 100644
--- a/api/src/glfs.c
+++ b/api/src/glfs.c
@@ -554,6 +554,11 @@ pub_glfs_new (const char *volname)
int ret = -1;
glusterfs_ctx_t *ctx = NULL;
+ if (!volname) {
+ errno = EINVAL;
+ return NULL;
+ }
+
ctx = glusterfs_ctx_new ();
if (!ctx) {
return NULL;
@@ -894,6 +899,11 @@ pub_glfs_fini (struct glfs *fs)
int fs_init = 0;
int err = -1;
+ if (!fs) {
+ errno = EINVAL;
+ return 0;
+ }
+
ctx = fs->ctx;
if (ctx->mgmt) {
rpc_clnt_disable (ctx->mgmt);