diff options
author | nik-redhat <[email protected]> | 2020-09-03 15:42:45 +0530 |
---|---|---|
committer | MOHIT AGRAWAL <[email protected]> | 2020-09-04 11:11:44 +0000 |
commit | cede859c7312ad09bae90f6c0f16a751f830905b (patch) | |
tree | e00a3e865b29926a45fa3a10bec9b8c37e07ab5a | |
parent | 865cca1190e233381f975ff36118f46e29477dcf (diff) | |
download | glusterfs-cede859c7312ad09bae90f6c0f16a751f830905b.tar.gz glusterfs-cede859c7312ad09bae90f6c0f16a751f830905b.tar.xz glusterfs-cede859c7312ad09bae90f6c0f16a751f830905b.zip |
glusterd: use after free (coverity issue)
Issue:
dict_unref is called on the same dict again,
in the out label of the code, which causes the
use after free issue.
Fix:
Set the dict to NULL after unref, to avoid
use after free issue.
CID: 1430127
Updates: #1060
Change-Id: Ide9a5cbc5f496705c671e72b0260da6d4c06f16d
Signed-off-by: nik-redhat <[email protected]>
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c index d96d5dd2cf..995268b796 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c @@ -2037,8 +2037,9 @@ glusterd_update_snaps_synctask(void *opaque) "Failed to remove snap %s", snap->snapname); goto out; } - if (dict) - dict_unref(dict); + + dict_unref(dict); + dict = NULL; } snprintf(buf, sizeof(buf), "%s.accept_peer_data", prefix); ret = dict_get_int32(peer_data, buf, &val); |