[lttng-dev] [PATCH lttng-tools] Fix: free previous instance of url (alloc_url) on default live url assignation

Jonathan Rajotte jonathan.rajotte-julien at efficios.com
Mon Dec 12 21:16:18 UTC 2016


Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
---
 src/bin/lttng/commands/create.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/bin/lttng/commands/create.c b/src/bin/lttng/commands/create.c
index 0f7d1a4..e6f15c7 100644
--- a/src/bin/lttng/commands/create.c
+++ b/src/bin/lttng/commands/create.c
@@ -342,6 +342,12 @@ static int create_session(void)
 
 	/* Use default live URL if NO url is/are found. */
 	if ((opt_live_timer && !opt_url) && (opt_live_timer && !opt_data_url)) {
+		/* Override the url */
+		if (url) {
+			free(url);
+			url = NULL;
+		}
+
 		ret = asprintf(&alloc_url, "net://127.0.0.1");
 		if (ret < 0) {
 			PERROR("asprintf default live URL");
-- 
2.7.4



More information about the lttng-dev mailing list