summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Scherer <misc@redhat.com>2017-02-22 17:09:46 +0100
committerJeff Darcy <jdarcy@redhat.com>2017-03-03 10:35:21 -0500
commitaaa5b2ec2f0ef1a62047c9ab91d957c7b0a1552a (patch)
tree4e5f16dcb53731596e03176951d9a92d8ae597e3
parent843945aed2a4b99a4fd1492b68b18ee80c5c994c (diff)
Fix bad free
Since rsp.path is assigned a constant string, free would operate on a incorrect pointer, with likely bad results. Found by coverity scan Change-Id: I4befdd78573daa3c0c3013100f7ae69a2dcae36a BUG: 789278 Signed-off-by: Michael Scherer <misc@redhat.com> Reviewed-on: https://review.gluster.org/16716 Smoke: Gluster Build System <jenkins@build.gluster.org> Tested-by: N Balachandran <nbalacha@redhat.com> Reviewed-by: N Balachandran <nbalacha@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 40f5704b698..2a497974d77 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -3204,7 +3204,7 @@ __glusterd_handle_mount (rpcsvc_request_t *req)
out:
if (!rsp.path)
- rsp.path = "";
+ rsp.path = gf_strdup("");
glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gf1_cli_mount_rsp);
@@ -3212,8 +3212,8 @@ __glusterd_handle_mount (rpcsvc_request_t *req)
if (dict)
dict_unref (dict);
- if (*rsp.path)
- GF_FREE (rsp.path);
+
+ GF_FREE (rsp.path);
glusterd_friend_sm ();
glusterd_op_sm ();