From: Michael Jeanson Date: Tue, 17 May 2016 18:08:00 +0000 (-0400) Subject: Fix: Free variables before strdup() X-Git-Tag: v2.8.0~53 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=fa0e2374fcd6efe85d2159b0c8a5a98b04e03979;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 02903becd..987a9dda3 100644 --- a/src/bin/lttng/lttng.c +++ b/src/bin/lttng/lttng.c @@ -348,6 +348,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; @@ -355,6 +356,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;