Segfault running multipath -d -v 3 at HOL
Hi Christophe,
I'm seeing a segfault running multipath -d -v 3 at HOL. Here's the fix for the issue. It might be worth applying similar logic fixes to the rest of the free_x() calls in free_config(); let me know if you want that patch too.
cheers,
brian
libmultipath/config.c +2 -1
@@ -305,7 +305,8 @@ free_config (struct config * conf)free_blacklist_device (conf->blist_device);free_mptable (conf->mptable);free_hwtable (conf->hwtable); -free_keywords (conf->keywords); +if (conf->keywords) +free_keywords (conf->keywords);FREE (conf); }
libmultipath/parser.c +12 -0
@@ -18,6 +18,7 @@*/ #include <syslog.h> +#include <assert.h> #include "parser.h" #include "memory.h"
@@ -110,6 +111,9 @@ free_keywords(vector keywords)struct keyword *keyword;int i; +assert (keywords); +if (!keywords)return ; +for (i =0 ; i <VECTOR_SIZE (keywords); i++) { keyword =VECTOR_SLOT (keywords, i);if (keyword->sub)
@@ -483,3 +487,11 @@ init_data(char *conf_file, void (*init_kreturn r; } + +/* +* Local Variables: *** +* mode:c *** +* c-basic-offset:8 *** +* indent-tabs-mode:1 *** +* End: *** +*/
Quoted 7 lines · Brian Wong
Hi Christophe,
I'm seeing a segfault running
multipath -d -v 3at HOL. Here's the fix for the issue. It might be worth applying similar logic fixes to the rest of thefree_x()calls infree_config(); let me know if you want that patch too.
Thanks. I applied this bit.
Quoted 24 lines
libmultipath/parser.c +2
-0@@ -18,6 +18,7 @@*/ #include <syslog.h> #include "parser.h" #include "memory.h" @@ -110,6 +111,9 @@ free_keywords(vector keywords)struct keyword *keyword;int i; +if (!keywords)return ; +for (i =0 ; i <VECTOR_SIZE (keywords); i++) { keyword =VECTOR_SLOT (keywords, i);if (keyword->sub)
libmultipath/parser.c init_data(char *conf_file, void (*init_k · line 489
Quoted 3 lines
libmultipath/parser.c +0
-0@@ -483,3 +487,11 @@ init_data(char *conf_file, void (*init_kreturn r; }
Regards,
cvaroqui