From: Michael Jeanson Date: Tue, 17 May 2016 18:08:00 +0000 (-0400) Subject: Fix: Free variables before strdup() X-Git-Tag: v2.7.3~45 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=dd983eaa2e87ce0f671d9551e233560cb246e792;p=lttng-tools.git Fix: Free variables before strdup() Fixes coverity #1243047 and #1243050 Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng/lttng.c b/src/bin/lttng/lttng.c index bf07c83b7..7e4d03313 100644 --- a/src/bin/lttng/lttng.c +++ b/src/bin/lttng/lttng.c @@ -333,6 +333,7 @@ static int parse_args(int argc, char **argv) opt_no_sessiond = 1; break; case OPT_SESSION_PATH: + free(opt_sessiond_path); opt_sessiond_path = strdup(optarg); if (!opt_sessiond_path) { ret = -1; @@ -340,6 +341,7 @@ static int parse_args(int argc, char **argv) } break; case OPT_RELAYD_PATH: + free(opt_relayd_path); opt_relayd_path = strdup(optarg); if (!opt_relayd_path) { ret = -1;