Instead of repeatedly removing the first vector element, and shifting
the rest to fill in, call remove_map() without a vector, so it just
frees the devices. The vector will be completely cleaned up by
vector_free() immediately afterwards.

Signed-off-by: Benjamin Marzinski <bmarz...@redhat.com>
---
 libmultipath/structs_vec.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 5a618767..f3fdc5a6 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -392,10 +392,8 @@ remove_maps(struct vectors * vecs)
        if (!vecs)
                return;
 
-       vector_foreach_slot (vecs->mpvec, mpp, i) {
-               remove_map(mpp, vecs->pathvec, vecs->mpvec);
-               i--;
-       }
+       vector_foreach_slot (vecs->mpvec, mpp, i)
+               remove_map(mpp, vecs->pathvec, NULL);
 
        vector_free(vecs->mpvec);
        vecs->mpvec = NULL;
-- 
2.17.2

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel

Reply via email to