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 15:42:02 +0000 (11:42 -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 d730a1dae972fb6f76a3907c8e1ad95ed2be61e1..32c4210130d9227b1d4cb320cb66f80ccb6b28d5 100644 (file)
@@ -360,11 +360,11 @@ static int append_list_to_probes(const char *list)
 {
        char *next;
        int index = nr_probes, ret;
 {
        char *next;
        int index = nr_probes, ret;
-       char *tmp_list;
+       char *tmp_list, *cur_list;
 
        assert(list);
 
 
        assert(list);
 
-       tmp_list = strdup(list);
+       cur_list = tmp_list = strdup(list);
        if (!tmp_list) {
                PERROR("strdup temp list");
                return -ENOMEM;
        if (!tmp_list) {
                PERROR("strdup temp list");
                return -ENOMEM;
@@ -374,11 +374,11 @@ static int append_list_to_probes(const char *list)
                size_t name_len;
                struct kern_modules_param *cur_mod;
 
                size_t name_len;
                struct kern_modules_param *cur_mod;
 
-               next = strtok(tmp_list, ",");
+               next = strtok(cur_list, ",");
                if (!next) {
                        break;
                }
                if (!next) {
                        break;
                }
-               tmp_list = NULL;
+               cur_list = NULL;
 
                /* filter leading spaces */
                while (*next == ' ') {
 
                /* filter leading spaces */
                while (*next == ' ') {
This page took 0.02551 seconds and 4 git commands to generate.