device-mapper-multipath/0018-multipathd-fix-memory-leak-on-error-in-configure.patch
Benjamin Marzinski 996407fc5f device-mapper-multipath-0.7.7-7.gitb80318b
Update Source to latest upstream commit
Rename files
  * Previous patches 0001-0020 are now patches 0002-0021
  * Previous patches 0021-0028 are now patches 0026-0033
Add 0001-kpartx-Use-absolute-paths-to-create-mappings.patch
Add 0022-multipathd-check-for-NULL-udevice-in-cli_add_path.patch
Add 0023-libmultipath-remove-max_fds-code-duplication.patch
Add 0024-multipathd-set-return-code-for-multipathd-commands.patch
Add 0025-mpathpersist-fix-registration-rollback-issue.patch
  * The above 5 patches have been submitted upstream
2018-10-10 00:16:58 -05:00

68 lines
1.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 31 Jul 2018 16:35:53 -0500
Subject: [PATCH] multipathd: fix memory leak on error in configure
If configure fails after allocing mpvec, it must free it. Found by
coverity.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/main.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index 463b1b8..04dce04 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2278,7 +2278,7 @@ configure (struct vectors * vecs)
ret = path_discovery(vecs->pathvec, DI_ALL);
if (ret < 0) {
condlog(0, "configure failed at path discovery");
- return 1;
+ goto fail;
}
vector_foreach_slot (vecs->pathvec, pp, i){
@@ -2295,7 +2295,7 @@ configure (struct vectors * vecs)
}
if (map_discovery(vecs)) {
condlog(0, "configure failed at map discovery");
- return 1;
+ goto fail;
}
/*
@@ -2309,7 +2309,7 @@ configure (struct vectors * vecs)
force_reload = FORCE_RELOAD_YES;
if (ret) {
condlog(0, "configure failed while coalescing paths");
- return 1;
+ goto fail;
}
/*
@@ -2318,7 +2318,7 @@ configure (struct vectors * vecs)
*/
if (coalesce_maps(vecs, mpvec)) {
condlog(0, "configure failed while coalescing maps");
- return 1;
+ goto fail;
}
dm_lib_release();
@@ -2354,6 +2354,10 @@ configure (struct vectors * vecs)
i--;
}
return 0;
+
+fail:
+ vector_free(mpvec);
+ return 1;
}
int
--
2.7.4