Fix: relayd: missing session unlock on error path
[lttng-tools.git] / src / bin / lttng-relayd / live.c
index 7a62059ee8f7a9dadf8d84005e642f746eb7d806..37bdfc2e5a2c5326ae0104523d6c4d3c2994a98a 100644 (file)
@@ -1180,7 +1180,12 @@ int viewer_get_new_streams(struct relay_connection *conn)
                        LTTNG_VIEWER_SEEK_BEGINNING, &nb_total, &nb_unsent,
                        &nb_created, &closed);
        if (ret < 0) {
-               goto error_unlock_session;
+               /*
+                * This is caused by an internal error; propagate the negative
+                * 'ret' to close the connection.
+                */
+               response.status = htobe32(LTTNG_VIEWER_NEW_STREAMS_ERR);
+               goto send_reply_unlock;
        }
        send_streams = 1;
        response.status = htobe32(LTTNG_VIEWER_NEW_STREAMS_OK);
@@ -1235,10 +1240,6 @@ end_put_session:
        }
 error:
        return ret;
-error_unlock_session:
-       pthread_mutex_unlock(&session->lock);
-       session_put(session);
-       return ret;
 }
 
 /*
This page took 0.023549 seconds and 4 git commands to generate.