diff options
| author | Soumya Koduri <skoduri@redhat.com> | 2017-05-03 18:39:14 +0530 | 
|---|---|---|
| committer | Niels de Vos <ndevos@redhat.com> | 2017-05-05 13:56:33 +0000 | 
| commit | fa10c8a3528b95dc575bfedd30bcd68cc2dff25b (patch) | |
| tree | 4273881ad26a5ade8c0e1fdadb1245ad6042c956 | |
| parent | de80a9153e3b681d8b83aa6164c94e2829b9cf49 (diff) | |
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 <skoduri@redhat.com>
Reviewed-on: https://review.gluster.org/17161
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
| -rw-r--r-- | api/src/glfs-fops.c | 7 | ||||
| -rw-r--r-- | api/src/glfs-handleops.c | 1 | ||||
| -rw-r--r-- | api/src/glfs-mgmt.c | 3 | 
3 files changed, 9 insertions, 2 deletions
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) { diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c index de0a6deb87f..dbffa9e26bf 100644 --- a/api/src/glfs-handleops.c +++ b/api/src/glfs-handleops.c @@ -2089,6 +2089,7 @@ pub_glfs_h_poll_upcall (struct glfs *fs, struct glfs_upcall **up_arg)                  case GF_UPCALL_RECALL_LEASE:                          gf_log ("glfs_h_poll_upcall", GF_LOG_DEBUG,                                  "UPCALL_RECALL_LEASE is not implemented yet"); +                /* fallthrough till we support leases */                  case GF_UPCALL_EVENT_NULL:                  /* no 'default:' label, to force handling all upcall events */                          errno = ENOENT; diff --git a/api/src/glfs-mgmt.c b/api/src/glfs-mgmt.c index 1726dac6ce4..bb4e77a1467 100644 --- a/api/src/glfs-mgmt.c +++ b/api/src/glfs-mgmt.c @@ -984,7 +984,8 @@ glfs_mgmt_init (struct glfs *fs)                  host = "localhost";          } -        if (!strcmp (cmd_args->volfile_server_transport, "unix")) { +        if (cmd_args->volfile_server_transport && +            !strcmp (cmd_args->volfile_server_transport, "unix")) {                  ret = rpc_transport_unix_options_build (&options, host, 0);          } else {                  ret = rpc_transport_inet_options_build (&options, host, port);  | 
