Fix relayd: NULL ptr deref
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 26 Sep 2012 02:10:06 +0000 (22:10 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 26 Sep 2012 02:13:49 +0000 (22:13 -0400)
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-relayd/main.c

index 15e2b2266f7264d31b3029e7dad0bdac5c2f6576..d01491e9cbb400257892a913ee2aab590783b9af 100644 (file)
@@ -1267,7 +1267,7 @@ int relay_send_version(struct lttcomm_relayd_hdr *recv_hdr,
 {
        int ret = htobe32(LTTNG_OK);
        struct lttcomm_relayd_version reply;
 {
        int ret = htobe32(LTTNG_OK);
        struct lttcomm_relayd_version reply;
-       struct relay_session *session = NULL;
+       struct relay_session *session;
 
        if (cmd->session == NULL) {
                session = zmalloc(sizeof(struct relay_session));
 
        if (cmd->session == NULL) {
                session = zmalloc(sizeof(struct relay_session));
@@ -1279,6 +1279,8 @@ int relay_send_version(struct lttcomm_relayd_hdr *recv_hdr,
                session->id = ++last_relay_session_id;
                DBG("Created session %" PRIu64, session->id);
                cmd->session = session;
                session->id = ++last_relay_session_id;
                DBG("Created session %" PRIu64, session->id);
                cmd->session = session;
+       } else {
+               session = cmd->session;
        }
        session->version_check_done = 1;
 
        }
        session->version_check_done = 1;
 
This page took 0.028735 seconds and 4 git commands to generate.