From 9b3c799fa3a5535e189d18200324d912339ac6a6 Mon Sep 17 00:00:00 2001 From: Prashanth Pai Date: Tue, 24 Feb 2015 16:48:20 +0530 Subject: gfapi: Add NULL check for volname in glfs_new() BUG: 1199388 Change-Id: I66cb65355504eb47e4392576029a9a5422996a1b Signed-off-by: Prashanth Pai Reviewed-on: http://review.gluster.org/9735 Reviewed-by: Shyamsundar Ranganathan Tested-by: Gluster Build System Reviewed-by: Niels de Vos --- api/src/glfs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'api/src') 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); -- cgit