Add liblttng-ctl destructor to cleanup memory
[lttng-tools.git] / src / lib / lttng-ctl / lttng-ctl.c
index 67c5972191016d8eafbf74d1e34faea0e8221e7f..bab62458b2b1967eb012df9e9dcb990e2f7775b8 100644 (file)
@@ -1625,7 +1625,7 @@ int _lttng_create_session_ext(const char *name, const char *url,
 
        lsm.u.uri.size = size;
 
-       if (uris[0].dtype != LTTNG_DST_PATH && strlen(uris[0].subdir) == 0) {
+       if (size > 0 && uris[0].dtype != LTTNG_DST_PATH && strlen(uris[0].subdir) == 0) {
                ret = snprintf(uris[0].subdir, sizeof(uris[0].subdir), "%s-%s", name,
                                datetime);
                if (ret < 0) {
@@ -1680,3 +1680,11 @@ static void __attribute__((constructor)) init()
        /* Set socket for health check */
        (void) set_health_socket_path();
 }
+
+/*
+ * lib destructor
+ */
+static void __attribute__((destructor)) lttng_ctl_exit()
+{
+       free(tracing_group);
+}
This page took 0.023226 seconds and 4 git commands to generate.