From fa10c8a3528b95dc575bfedd30bcd68cc2dff25b Mon Sep 17 00:00:00 2001 From: Soumya Koduri Date: Wed, 3 May 2017 18:39:14 +0530 Subject: gfapi: Fix few severe coverity issues From https://download.gluster.org/pub/gluster/glusterfs/static-analysis/master/glusterfs-coverity/2017-05-03-6484558c/html/ fixes coverity#189, 248, 250, 488, 546 Change-Id: I7c4aa5bf6c367344602748dfd736de27f341cca2 BUG: 789278 Signed-off-by: Soumya Koduri Reviewed-on: https://review.gluster.org/17161 Smoke: Gluster Build System Reviewed-by: Niels de Vos NetBSD-regression: NetBSD Build System Reviewed-by: Amar Tumballi CentOS-regression: Gluster Build System --- api/src/glfs-fops.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'api/src/glfs-fops.c') diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index 1bb958fc1b7..e8d4f9af18f 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -4664,6 +4664,11 @@ pub_glfs_xreaddirplus_r (struct glfs_fd *glfd, uint32_t flags, /* reached EOD, ret = 0 */ ret = 0; *res = NULL; + *xstat_p = NULL; + + /* free xstat as applications shall not be using it */ + glfs_free (xstat); + goto out; } @@ -4699,11 +4704,11 @@ pub_glfs_xreaddirplus_r (struct glfs_fd *glfd, uint32_t flags, ret = xstat->flags_handled; *xstat_p = xstat; -out: gf_msg_debug (THIS->name, 0, "xreaddirp- requested_flags (%x) , processed_flags (%x)", flags, xstat->flags_handled); +out: GF_REF_PUT (glfd); if (ret < 0) { -- cgit