diff options
author | Avra Sengupta <asengupt@redhat.com> | 2015-02-20 12:58:20 +0530 |
---|---|---|
committer | Krishnan Parthasarathi <kparthas@redhat.com> | 2015-02-23 23:05:26 -0800 |
commit | a4a760a3cf793857e5fac7d13f5ef7028d30f666 (patch) | |
tree | bf5f1a94acf7458db0478dddf1bf3de84e35d9f9 /xlators/mgmt/glusterd/src/glusterd-snapshot.c | |
parent | bf22868f82c89e0ee68d394a2257869a36662eaa (diff) |
glusterd/snapshot: Fix the ret check in gd_restore_snap_volume
In gd_restore_snap_volume(), irrespective of the ret value
we were trying to do a list_add_tail to new_volinfo variable.
There might be cases where this variable might be NULL, and hence
cause a crash.
Change-Id: I158c5ae655ea27c9a91be3cb9d95a80a3dd05559
BUG: 1194538
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/9719
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-snapshot.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapshot.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c index 41559e75ea0..171d071efc3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c @@ -8264,12 +8264,13 @@ gd_restore_snap_volume (dict_t *dict, dict_t *rsp_dict, ret = 0; out: - if (ret && NULL != new_volinfo) { + if (ret) { /* In case of any failure we should free new_volinfo. Doing * this will also remove the entry we added in conf->volumes * if it was added there. */ - (void)glusterd_volinfo_delete (new_volinfo); + if (new_volinfo) + (void)glusterd_volinfo_delete (new_volinfo); } else { list_for_each_entry_safe (voliter, temp_volinfo, &orig_vol->snap_volumes, snapvol_list) { |