From ce199db848e663ffa040015106725553eafb1c98 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 2 Mar 2018 15:49:12 +0100 Subject: [PATCH] raid: fix error path for lv_raid_data_offset Avoid using allocated status on error path. --- WHATS_NEW | 1 + lib/activate/activate.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 46f66b0f7..52cf4bc76 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.178 - ===================================== + Fix memleak on error path when obtaining lv_raid_data_offset. Fix compatibility size test of extended external origin. Add external_origin visiting in for_each_sub_lv(). Ensure cluster commands drop their device cache before locking VG. diff --git a/lib/activate/activate.c b/lib/activate/activate.c index 3052f3189..f5e9ef962 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -1006,8 +1006,10 @@ int lv_raid_data_offset(const struct logical_volume *lv, uint64_t *data_offset) if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1))) return_0; - if (!(r = dev_manager_raid_status(dm, lv, &status))) - stack; + if (!(r = dev_manager_raid_status(dm, lv, &status))) { + dev_manager_destroy(dm); + return_0; + } *data_offset = status->data_offset;