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