Fix: relayd memleaks
authorDavid Goulet <dgoulet@efficios.com>
Fri, 26 Oct 2012 17:04:27 +0000 (13:04 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 26 Oct 2012 17:04:27 +0000 (13:04 -0400)
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-relayd/main.c

index c09c0c52582a45e03e5d7e292167bc907ff3bde6..152e4bbc86911a00a53f8598e472e7b1545736eb 100644 (file)
@@ -884,7 +884,8 @@ void relay_delete_session(struct relay_command *cmd, struct lttng_ht *streams_ht
        }
 
        DBG("Relay deleting session %" PRIu64, cmd->session->id);
-       free(cmd->session->sock);
+
+       lttcomm_destroy_sock(cmd->session->sock);
 
        rcu_read_lock();
        cds_lfht_for_each_entry(streams_ht->ht, &iter.iter, node, node) {
@@ -902,6 +903,8 @@ void relay_delete_session(struct relay_command *cmd, struct lttng_ht *streams_ht
                }
        }
        rcu_read_unlock();
+
+       free(cmd->session);
 }
 
 /*
@@ -1599,6 +1602,8 @@ void deferred_free_connection(struct rcu_head *head)
 {
        struct relay_command *relay_connection =
                caa_container_of(head, struct relay_command, rcu_node);
+
+       lttcomm_destroy_sock(relay_connection->sock);
        free(relay_connection);
 }
 
@@ -1614,6 +1619,7 @@ void relay_del_connection(struct lttng_ht *relay_connections_ht,
        if (relay_connection->type == RELAY_CONTROL) {
                relay_delete_session(relay_connection, streams_ht);
        }
+
        call_rcu(&relay_connection->rcu_node,
                deferred_free_connection);
 }
This page took 0.03539 seconds and 4 git commands to generate.