d1681e
From ee1c4f7d1303c61725f73870f32afa1bc4f68854 Mon Sep 17 00:00:00 2001
d1681e
From: Atin Mukherjee <amukherj@redhat.com>
d1681e
Date: Thu, 4 Jan 2018 22:07:54 +0530
d1681e
Subject: [PATCH 181/201] glusterd: get-state memory leak fix
d1681e
d1681e
>upstream mainline patch : https://review.gluster.org/#/c/19139/
d1681e
d1681e
Change-Id: Ic4fcf2087f295d3dade944efb8fd08f7e2d7d516
d1681e
BUG: 1528733
d1681e
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
d1681e
Reviewed-on: https://code.engineering.redhat.com/gerrit/132079
d1681e
Tested-by: RHGS Build Bot <nigelb@redhat.com>
d1681e
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
d1681e
---
d1681e
 xlators/mgmt/glusterd/src/glusterd-handler.c | 16 ++++++++++++++--
d1681e
 1 file changed, 14 insertions(+), 2 deletions(-)
d1681e
d1681e
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
d1681e
index cf280a7..81926a8 100644
d1681e
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
d1681e
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
d1681e
@@ -5180,6 +5180,8 @@ glusterd_print_gsync_status_by_vol (FILE *fp, glusterd_volinfo_t *volinfo)
d1681e
         if (ret)
d1681e
                 goto out;
d1681e
 out:
d1681e
+        if (gsync_rsp_dict)
d1681e
+                dict_unref (gsync_rsp_dict);
d1681e
         return ret;
d1681e
 }
d1681e
 
d1681e
@@ -5495,9 +5497,19 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict)
d1681e
         if (odir[odirlen-1] != '/')
d1681e
                 strcat (odir, "/");
d1681e
 
d1681e
-        gf_asprintf (&ofilepath, "%s%s", odir, filename);
d1681e
+        ret = gf_asprintf (&ofilepath, "%s%s", odir, filename);
d1681e
+        if (ret < 0) {
d1681e
+                GF_FREE (odir);
d1681e
+                GF_FREE (filename);
d1681e
+                gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
d1681e
+                        "Unable to get the output path");
d1681e
+                ret = -1;
d1681e
+                goto out;
d1681e
+        }
d1681e
+        GF_FREE (odir);
d1681e
+        GF_FREE (filename);
d1681e
 
d1681e
-        ret = dict_set_str (dict, "ofilepath", ofilepath);
d1681e
+        ret = dict_set_dynstr (dict, "ofilepath", ofilepath);
d1681e
         if (ret) {
d1681e
                 gf_msg (this->name, GF_LOG_ERROR, 0,
d1681e
                         GD_MSG_DICT_SET_FAILED, "Unable to set output path");
d1681e
-- 
d1681e
1.8.3.1
d1681e