[lttng-dev] [PATCH lttng-tools] Fix: Memory leaks on error paths in config_read_session_name
Christian Babeux
christian.babeux at efficios.com
Thu Feb 28 15:48:25 EST 2013
Signed-off-by: Christian Babeux <christian.babeux at efficios.com>
---
src/bin/lttng/conf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/bin/lttng/conf.c b/src/bin/lttng/conf.c
index c1bfcfd..7439c1c 100644
--- a/src/bin/lttng/conf.c
+++ b/src/bin/lttng/conf.c
@@ -203,6 +203,7 @@ char *config_read_session_name(char *path)
if (fp == NULL) {
ERR("Can't find valid lttng config %s/.lttngrc", path);
MSG("Did you create a session? (lttng create <my_session>)");
+ free(session_name);
goto error;
}
@@ -221,6 +222,7 @@ char *config_read_session_name(char *path)
}
error_close:
+ free(session_name);
ret = fclose(fp);
if (ret < 0) {
PERROR("close config read session name");
--
1.8.1.3
More information about the lttng-dev
mailing list