diff options
author | Sunny Kumar <sunkumar@redhat.com> | 2018-07-31 19:03:05 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-08-20 16:30:02 +0000 |
commit | a0fb796c233f30cbbde56768f7073e954e02dfcb (patch) | |
tree | 5a7321b9d92fba620dbd19d3da6dad78def4b2a7 | |
parent | a3a3b8ec67fa1609e06b1d919675e3df74d531e5 (diff) |
geo-rep : fix few coverity issues in procdiggy.c
This patch fixes BAD_FREE at line number 75,105 and
UNUSED_VALUE at line number 108.
CID : 1274068
scan detail at [1].
[1] https://scan6.coverity.com/reports.htm#v42401/p10714/fileInstanceId=84384726&defectInstanceId=25600457&mergedDefectId=727233
Change-Id: I8dff42546204bf78c178c9dcaba534888c5354e9
updates: bz#789278
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
-rw-r--r-- | geo-replication/src/procdiggy.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/geo-replication/src/procdiggy.c b/geo-replication/src/procdiggy.c index 35125d20ba8..4fb6a2405e4 100644 --- a/geo-replication/src/procdiggy.c +++ b/geo-replication/src/procdiggy.c @@ -72,8 +72,8 @@ pidinfo (pid_t pid, char **name) out: fclose (f); - if (pid == -1 && name && *name) - GF_FREE (name); + if (pid == -1 && name && *name) + GF_FREE (*name); if (pid == -2) fprintf (stderr, "out of memory\n"); return pid; @@ -104,8 +104,10 @@ prociter (int (*proch) (pid_t pid, pid_t ppid, char *tmpname, void *data), if (gf_string2int (de->d_name, &pid) != -1 && pid >= 0) { ppid = pidinfo (pid, &name); switch (ppid) { - case -1: continue; - case -2: ret = -1; break; + case -1: + continue; + case -2: + break; } ret = proch (pid, ppid, name, data); GF_FREE (name); |