diff options
| author | Atin Mukherjee <amukherj@redhat.com> | 2018-01-04 22:07:54 +0530 | 
|---|---|---|
| committer | Xavier Hernandez <jahernan@redhat.com> | 2018-01-08 09:28:07 +0000 | 
| commit | 6ad4c7ff050de6faa267e42a09ba35b8641f15db (patch) | |
| tree | f803e05d5aeb41521880f02f740fbe4aa664a1f8 | |
| parent | 5c22aed3f076544f3d6d276093b51225d5851b2e (diff) | |
glusterd: get-state memory leak fix
Change-Id: Ic4fcf2087f295d3dade944efb8fd08f7e2d7d516
BUG: 1531149
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 15 | 
1 files changed, 12 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index dbc9a595087..a6545fc66fd 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -5119,6 +5119,8 @@ glusterd_print_gsync_status_by_vol (FILE *fp, glusterd_volinfo_t *volinfo)          ret = glusterd_print_gsync_status (fp, gsync_rsp_dict);  out: +        if (gsync_rsp_dict) +                dict_unref (gsync_rsp_dict);          return ret;  } @@ -5440,12 +5442,19 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict)          if (odir[odirlen-1] != '/')                  strcat (odir, "/"); -        gf_asprintf (&ofilepath, "%s%s", odir, filename); - +        ret = gf_asprintf (&ofilepath, "%s%s", odir, filename); +        if (ret < 0) { +                GF_FREE (odir); +                GF_FREE (filename); +                gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED, +                        "Unable to get the output path"); +                ret = -1; +                goto out; +        }          GF_FREE (odir);          GF_FREE (filename); -        ret = dict_set_str (dict, "ofilepath", ofilepath); +        ret = dict_set_dynstr (dict, "ofilepath", ofilepath);          if (ret) {                  gf_msg (this->name, GF_LOG_ERROR, 0,                          GD_MSG_DICT_SET_FAILED, "Unable to set output path");  | 
