In dm_get_maps func, if vector_alloc_slot(mp) fails, the
mpp should be free.

Here we call free_multipath(mpp, KEEP_PATHS) to free map.

Signed-off-by: Lixiaokeng <[email protected]>
Signed-off-by: Zhiqiang Liu <[email protected]>

---
 libmultipath/devmapper.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index f597ff8b..92eef6f1 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -1198,8 +1198,10 @@ dm_get_maps (vector mp)
                if (!mpp)
                        goto out;

-               if (!vector_alloc_slot(mp))
+               if (!vector_alloc_slot(mp)) {
+                       free_multipath(mpp, KEEP_PATHS);
                        goto out;
+               }

                vector_set_slot(mp, mpp);
                mpp = NULL;
-- 

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel

Reply via email to