summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2012-06-05 14:15:54 +0530
committerAnand Avati <avati@redhat.com>2012-06-05 10:45:10 -0700
commit6eee473eba94697953e8b3e1b04fe5ef1de5f474 (patch)
treed435b4f4186690907c39a28257f3707ea86bbeb1 /cli/src
parent04fd2972fe8a9b9568ac781ba7677f13fdce0f57 (diff)
core: coverity fixes (mostly resource leak fixes)
currently working on obvious resource leak reports in coverity Change-Id: I261f4c578987b16da399ab5a504ad0fda0b176b1 Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 789278 Reviewed-on: http://review.gluster.com/3265 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/cli-cmd-parser.c17
-rw-r--r--cli/src/cli-rpc-ops.c4
2 files changed, 18 insertions, 3 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 02eb2c36992..f447ccae3d5 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -367,7 +367,7 @@ cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options
ret = dict_set_dynstr (dict, "transport", trans_type);
if (ret)
goto out;
-
+ trans_type = NULL;
ret = dict_set_dynstr (dict, "bricks", bricks);
if (ret)
@@ -385,6 +385,10 @@ out:
if (dict)
dict_destroy (dict);
}
+
+ if (trans_type)
+ GF_FREE (trans_type);
+
return ret;
}
@@ -1576,8 +1580,12 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
ret = dict_set_dynstr (dict, "op_value", append_str);
}
- if (!subop || dict_set_dynstr (dict, "subop", subop) != 0)
- ret = -1;
+ ret = -1;
+ if (subop) {
+ ret = dict_set_dynstr (dict, "subop", subop);
+ if (!ret)
+ subop = NULL;
+ }
}
out:
@@ -1589,6 +1597,9 @@ out:
} else
*options = dict;
+ if (subop)
+ GF_FREE (subop);
+
return ret;
}
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 7cc85e48320..091c74f5406 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -2780,6 +2780,7 @@ done:
if (local) {
local->dict = dict_ref (req_dict);
frame->local = local;
+ local = NULL;
}
ret = dict_allocate_and_serialize (req_dict,
@@ -2798,6 +2799,9 @@ done:
(xdrproc_t) xdr_gf_cli_req);
out:
+ if (local)
+ cli_local_wipe (local);
+
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
return ret;