Fix: various memleaks
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 19 Mar 2012 22:02:45 +0000 (18:02 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 19 Mar 2012 22:03:51 +0000 (18:03 -0400)
Thanks to valgrind.

Acked-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/bin/lttng-sessiond/main.c
src/bin/lttng-sessiond/trace-kernel.c
src/bin/lttng-sessiond/trace-ust.c
src/bin/lttng-sessiond/ust-app.c

index 8b09fc922ee48d166062439833d4f8cc9a7a6306..0c4d4b1f9b544f3916caaec859cd6c2cff06a27b 100644 (file)
@@ -3798,7 +3798,7 @@ static void *thread_manage_clients(void *data)
                                PERROR("close");
                        }
                        sock = -1;
-                       free(cmd_ctx);
+                       clean_command_ctx(&cmd_ctx);
                        continue;
                }
 
index 48f6eea7d60e6db4b2e79766c11ac1b6f3a1f12a..293ca381b6bf3a24f88907acf6cb9f32f60fd698 100644 (file)
@@ -228,6 +228,8 @@ struct ltt_kernel_event *trace_kernel_create_event(struct lttng_event *ev)
        return lke;
 
 error:
+       free(lke);
+       free(attr);
        return NULL;
 }
 
@@ -270,6 +272,8 @@ struct ltt_kernel_metadata *trace_kernel_create_metadata(char *path)
        return lkm;
 
 error:
+       free(lkm);
+       free(chan);
        return NULL;
 }
 
index 8cc1b59158ddfc3f840b73a6409f906029e5625c..5a8fc7dd988e300a70e6fd56b86b8a7bab6bae74 100644 (file)
@@ -121,6 +121,9 @@ struct ltt_ust_session *trace_ust_create_session(char *path, int session_id,
        return lus;
 
 error_free_session:
+       lttng_ht_destroy(lus->domain_global.channels);
+       lttng_ht_destroy(lus->domain_exec);
+       lttng_ht_destroy(lus->domain_pid);
        free(lus);
 error:
        return NULL;
@@ -180,6 +183,8 @@ struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *chan,
        return luc;
 
 error_free_channel:
+       lttng_ht_destroy(luc->ctx);
+       lttng_ht_destroy(luc->events);
        free(luc);
 error:
        return NULL;
@@ -253,6 +258,7 @@ struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev)
        return lue;
 
 error_free_event:
+       lttng_ht_destroy(lue->ctx);
        free(lue);
 error:
        return NULL;
index 10ffe403bc44448a9d9511fb60e3983345988829..79526fceb61f5d712174baaad97562d6cdae889e 100644 (file)
@@ -150,6 +150,7 @@ void delete_ust_app_session(int sock, struct ust_app_session *ua_sess)
                        ustctl_release_object(sock, ua_sess->metadata->obj);
                        free(ua_sess->metadata->obj);
                }
+               trace_ust_destroy_metadata(ua_sess->metadata);
        }
 
        cds_lfht_for_each_entry(ua_sess->channels->ht, &iter.iter, ua_chan,
@@ -1980,6 +1981,7 @@ int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app)
                                        &ustream->obj);
                        if (ret < 0) {
                                /* Got all streams */
+                               free(ustream);
                                break;
                        }
                        ustream->handle = ustream->obj->handle;
@@ -1991,6 +1993,10 @@ int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app)
                                        ua_chan->streams.count++);
                        if (ret < 0) {
                                PERROR("asprintf UST create stream");
+                               /*
+                                * XXX what should we do here with the
+                                * stream ?
+                                */
                                continue;
                        }
                        DBG2("UST stream %d ready at %s", ua_chan->streams.count,
This page took 0.031213 seconds and 4 git commands to generate.