Signed-off-by: Martin Wilck <mwi...@suse.com>
---
 libmultipath/config.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libmultipath/config.c b/libmultipath/config.c
index 085a3e12..8769441c 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -551,6 +551,11 @@ free_config (struct config * conf)
        FREE(conf);
 }
 
+static void free_namelist(void *nl)
+{
+       free(nl);
+}
+
 /* if multipath fails to process the config directory, it should continue,
  * with just a warning message */
 static void
@@ -574,7 +579,9 @@ process_config_dir(struct config *conf, vector keywords, 
char *dir)
                        condlog(0, "couldn't open configuration dir '%s': %s",
                                dir, strerror(errno));
                return;
-       }
+       } else if (n == 0)
+               return;
+       pthread_cleanup_push(free_namelist, namelist);
        for (i = 0; i < n; i++) {
                if (!strstr(namelist[i]->d_name, ".conf"))
                        continue;
@@ -586,6 +593,7 @@ process_config_dir(struct config *conf, vector keywords, 
char *dir)
                        factorize_hwtable(conf->hwtable, old_hwtable_size);
 
        }
+       pthread_cleanup_pop(1);
 }
 
 struct config *
-- 
2.17.0

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

Reply via email to