Fix: rotation client example: leak of handle on error
[lttng-tools.git] / doc / examples / rotation / rotate-client-example.c
index a9d8b9f311a7edbbb1a94c642075134724a1d83c..34287e8bb6e0f2a38ceb64a959d445bfc0e16b07 100644 (file)
@@ -61,7 +61,7 @@ int setup_session(const char *session_name, const char *path)
        int ret;
        struct lttng_domain dom;
        struct lttng_event ev;
-       struct lttng_handle *chan_handle;
+       struct lttng_handle *chan_handle = NULL;
 
        printf("Creating session %s\n", session_name);
        ret = lttng_create_session(session_name, path);
@@ -98,11 +98,10 @@ int setup_session(const char *session_name, const char *path)
                goto end;
        }
 
-       lttng_destroy_handle(chan_handle);
-
        ret = 0;
 
 end:
+       lttng_destroy_handle(chan_handle);
        return ret;
 }
 
This page took 0.025754 seconds and 5 git commands to generate.