From 2f0e04ab6ae6ba7a83c211727db282aee43452c7 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Thu, 9 Jun 2016 11:14:22 -0400 Subject: [PATCH] Fix: memory management in create.c --- src/bin/lttng/commands/create.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/bin/lttng/commands/create.c b/src/bin/lttng/commands/create.c index 2e45d004e..c8027133d 100644 --- a/src/bin/lttng/commands/create.c +++ b/src/bin/lttng/commands/create.c @@ -722,7 +722,9 @@ static int create_session_from_template(struct config_document *template, ret = CMD_ERROR; goto error; } + config_element_free(temp_element); + temp_element = NULL; temp_element = config_element_create("data_uri", tmp_data_uri); @@ -739,6 +741,7 @@ static int create_session_from_template(struct config_document *template, goto error; } config_element_free(temp_element); + temp_element = NULL; break; default: ret = CMD_ERROR; @@ -759,6 +762,10 @@ static int create_session_from_template(struct config_document *template, goto error; } + config_element_free(temp_element_child); + temp_element_child = NULL; + + /* * validate and replace the destination node for each session type * TODO: export string as const and simply assign a base path for the @@ -790,6 +797,8 @@ static int create_session_from_template(struct config_document *template, goto error; } + config_element_free(temp_element); + temp_element = NULL; if (ret) { ERR("%s", lttng_strerror(ret)); @@ -816,6 +825,9 @@ static int create_session_from_template(struct config_document *template, ret = CMD_ERROR; goto error; } + + config_element_free(temp_element); + temp_element = NULL; } ret = config_load_configuration_sessions(template, session_name, 0); @@ -1172,8 +1184,10 @@ static int create_session(void) error: /* Session temp stuff */ + config_document_free(template); free(session_name_date); free(uris); + free(traces_path); if (ret < 0) { ERR("%s", lttng_strerror(ret)); -- 2.34.1