[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] [patch 2/2] multipath-tools: Intialize pointer passed to get_cmdvec



From: Christof Schmitt <christof schmitt de ibm com>

get_cmdvec can return before the vector argument has been initialized. Fix this
by initializing the pointer before passing it to get_cmdvec. This fixes a
segfault in the interactive mode when hitting the tab key directly on the
command prompt.

Signed-off-by: Christof Schmitt <christof schmitt de ibm com>
---
 multipathd/cli.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/multipathd/cli.c
+++ b/multipathd/cli.c
@@ -363,7 +363,7 @@ parse_cmd (char * cmd, char ** reply, in
 {
 	int r;
 	struct handler * h;
-	vector cmdvec;
+	vector cmdvec = NULL;
 
 	r = get_cmdvec(cmd, &cmdvec);
 
@@ -467,7 +467,7 @@ key_generator (const char * str, int sta
 	struct key * kw;
 	int i;
 	struct handler *h;
-	vector v;
+	vector v = NULL;
 
 	if (!state) {
 		index = 0;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]