Fix: modprobe.c: fix tmp_list memory leak
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 28 Apr 2015 21:09:16 +0000 (17:09 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 6 May 2015 16:10:57 +0000 (12:10 -0400)
Reported-by: Hannes Weisbach <hannes.weisbach@mailbox.tu-dresden.de>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/modprobe.c

index 15d075a76e5d6615fd79262b7f1825220e04658b..bc2234f024a61e1d0a76c36dc8fa55396daf9e28 100644 (file)
@@ -359,10 +359,11 @@ static int append_list_to_probes(const char *list)
 {
        char *next;
        int index = nr_probes, ret;
+       char *tmp_list, *cur_list;
 
        assert(list);
 
-       char *tmp_list = strdup(list);
+       cur_list = tmp_list = strdup(list);
        if (!tmp_list) {
                PERROR("strdup temp list");
                return -ENOMEM;
@@ -372,11 +373,11 @@ static int append_list_to_probes(const char *list)
                size_t name_len;
                struct kern_modules_param *cur_mod;
 
-               next = strtok(tmp_list, ",");
+               next = strtok(cur_list, ",");
                if (!next) {
                        break;
                }
-               tmp_list = NULL;
+               cur_list = NULL;
 
                /* filter leading spaces */
                while (*next == ' ') {
This page took 0.026508 seconds and 4 git commands to generate.