Fix: memory management in create.c
[lttng-tools.git] / src / bin / lttng / commands / create.c
index 2e45d004e62cdf66780a6ac5a9878bff5eccf5ea..c8027133d2a0666cf9b2f79dc3c556a046293fc1 100644 (file)
@@ -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));
This page took 0.024538 seconds and 5 git commands to generate.