From: Philippe Proulx Date: Tue, 28 Apr 2015 21:09:16 +0000 (-0400) Subject: Fix: modprobe.c: fix tmp_list memory leak X-Git-Tag: v2.7.0-rc1~34 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=44603c80f2e1ce55b6237a02810de8e7fc1687d4;p=lttng-tools.git Fix: modprobe.c: fix tmp_list memory leak Reported-by: Hannes Weisbach Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/modprobe.c b/src/bin/lttng-sessiond/modprobe.c index d730a1dae..32c421013 100644 --- a/src/bin/lttng-sessiond/modprobe.c +++ b/src/bin/lttng-sessiond/modprobe.c @@ -360,11 +360,11 @@ static int append_list_to_probes(const char *list) { char *next; int index = nr_probes, ret; - char *tmp_list; + char *tmp_list, *cur_list; assert(list); - tmp_list = strdup(list); + cur_list = tmp_list = strdup(list); 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; - next = strtok(tmp_list, ","); + next = strtok(cur_list, ","); if (!next) { break; } - tmp_list = NULL; + cur_list = NULL; /* filter leading spaces */ while (*next == ' ') {