Fix memory leak in lttng cli
authorDavid Goulet <dgoulet@efficios.com>
Wed, 1 Feb 2012 23:38:13 +0000 (18:38 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 1 Feb 2012 23:38:13 +0000 (18:38 -0500)
Reported-by: Daniel U. Thibault <daniel.thibault@drdc-rddc.gc.ca>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng/commands/disable_channels.c
src/bin/lttng/commands/disable_events.c
src/bin/lttng/commands/enable_channels.c

index 976611b12b1730188922161a277f5f3153a53fce..ccd5446db4a44bb0b1ce4c0f598e63d13d798e87 100644 (file)
@@ -193,6 +193,9 @@ int cmd_disable_channels(int argc, const char **argv)
        ret = disable_channels(session_name);
 
 end:
        ret = disable_channels(session_name);
 
 end:
+       if (!opt_session_name && session_name) {
+               free(session_name);
+       }
        poptFreeContext(pc);
        return ret;
 }
        poptFreeContext(pc);
        return ret;
 }
index f447676f312073987a75f1e2ee15ad6a6ab70181..b30ec1fdc644f5a0e2d2bc3202428f31bfdbfe2d 100644 (file)
@@ -228,6 +228,9 @@ int cmd_disable_events(int argc, const char **argv)
        ret = disable_events(session_name);
 
 end:
        ret = disable_events(session_name);
 
 end:
+       if (!opt_session_name && session_name) {
+               free(session_name);
+       }
        poptFreeContext(pc);
        return ret;
 }
        poptFreeContext(pc);
        return ret;
 }
index f094e12feb84f51f5e2130bfaf3d5b494a9e1e7e..692480e816f28c2e2d808d326a8520c2a59e750d 100644 (file)
@@ -303,6 +303,9 @@ int cmd_enable_channels(int argc, const char **argv)
        ret = enable_channel(session_name);
 
 end:
        ret = enable_channel(session_name);
 
 end:
+       if (!opt_session_name && session_name) {
+               free(session_name);
+       }
        poptFreeContext(pc);
        return ret;
 }
        poptFreeContext(pc);
        return ret;
 }
This page took 0.027366 seconds and 4 git commands to generate.