diff options
author | arao <arao@redhat.com> | 2015-04-01 12:29:24 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-04-09 09:46:35 +0000 |
commit | 093639d8003695889923cc7a106519c1f9a4e2f0 (patch) | |
tree | 5e049134ff3e02602f8cc76744d803edd29c0072 | |
parent | 221f260c9d5793d9a1b4ab60dd160bdd41ff3b59 (diff) |
cli: Fixing dereference after null check
and dead code removal
CID: 1124609
CID: 1124596
CID: 1124471
CID: 1124475
CID: 1124476
The pointer variables are checked before
dereferencing and the dead code is removed
BUG: 789278
Change-Id: Ia532733a64401d71ccf1f2b6e434d7bc910e0ed1
Signed-off-by: arao <arao@redhat.com>
Reviewed-on: http://review.gluster.org/10083
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r-- | cli/src/cli-rpc-ops.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 3065f64f0eb..6bfe78e4354 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -508,14 +508,13 @@ cli_out_options ( char *substr, char *optstr, char *valstr) while (ptr1) { + /* Avoiding segmentation fault. */ + if (!ptr2) + return; if (*ptr1 != *ptr2) break; ptr1++; ptr2++; - if (!ptr1) - return; - if (!ptr2) - return; } if (*ptr2 == '\0') @@ -1094,8 +1093,6 @@ out: cli_local_wipe (local); if (rsp.dict.dict_val) free (rsp.dict.dict_val); - if (dict) - dict_unref (dict); gf_log ("", GF_LOG_DEBUG, "Returning with %d", ret); return ret; @@ -1190,7 +1187,7 @@ gf_cli_start_volume_cbk (struct rpc_req *req, struct iovec *iov, ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (frame->this->name, GF_LOG_ERROR, "dict get failed"); + gf_log ("cli", GF_LOG_ERROR, "dict get failed"); goto out; } @@ -1614,7 +1611,7 @@ gf_cli_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov, ret = dict_get_int32 (local_dict, "rebalance-command", (int32_t*)&cmd); if (ret) { - gf_log (frame->this->name, GF_LOG_ERROR, + gf_log ("cli", GF_LOG_ERROR, "Failed to get command"); goto out; } |