X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-app.c;h=66b50eb43df98ea42c0700c5cedd5e9f28e17e8b;hb=df4f5a87a21110a5f9447bcfd7ffeb25098a5fd4;hp=56860d714e3a6e5a605e75c56a1fb200037fd1bb;hpb=3b9677124ab48bddc945ca67947c49b87b5853e0;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 56860d714..66b50eb43 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -1993,7 +1993,8 @@ static int setup_buffer_reg_pid(struct ust_app_session *ua_sess, app->byte_order, app->version.major, app->version.minor, reg_pid->root_shm_path, reg_pid->shm_path, ua_sess->effective_credentials.uid, - ua_sess->effective_credentials.gid); + ua_sess->effective_credentials.gid, ua_sess->tracing_id, + app->uid); if (ret < 0) { /* * reg_pid->registry->reg.ust is NULL upon error, so we need to @@ -2060,7 +2061,8 @@ static int setup_buffer_reg_uid(struct ltt_ust_session *usess, app->uint64_t_alignment, app->long_alignment, app->byte_order, app->version.major, app->version.minor, reg_uid->root_shm_path, - reg_uid->shm_path, usess->uid, usess->gid); + reg_uid->shm_path, usess->uid, usess->gid, + ua_sess->tracing_id, app->uid); if (ret < 0) { /* * reg_uid->registry->reg.ust is NULL upon error, so we need to @@ -5883,6 +5885,7 @@ enum lttng_error_code ust_app_snapshot_record( enum lttng_error_code status = LTTNG_OK; struct lttng_ht_iter iter; struct ust_app *app; + char *trace_path = NULL; assert(usess); assert(output); @@ -5897,7 +5900,6 @@ enum lttng_error_code ust_app_snapshot_record( cds_list_for_each_entry(reg, &usess->buffer_reg_uid_list, lnode) { struct buffer_reg_channel *reg_chan; struct consumer_socket *socket; - char *trace_path = NULL; char pathname[PATH_MAX]; if (!reg->registry->reg.ust->metadata_key) { @@ -5926,6 +5928,8 @@ enum lttng_error_code ust_app_snapshot_record( status = LTTNG_ERR_INVALID; goto error; } + /* Free path allowed on previous iteration. */ + free(trace_path); trace_path = setup_channel_trace_path(usess->consumer, pathname); if (!trace_path) { status = LTTNG_ERR_INVALID; @@ -5940,14 +5944,12 @@ enum lttng_error_code ust_app_snapshot_record( usess->gid, trace_path, wait, nb_packets_per_stream); if (status != LTTNG_OK) { - free(trace_path); goto error; } } status = consumer_snapshot_channel(socket, reg->registry->reg.ust->metadata_key, output, 1, usess->uid, usess->gid, trace_path, wait, 0); - free(trace_path); if (status != LTTNG_OK) { goto error; } @@ -5962,7 +5964,6 @@ enum lttng_error_code ust_app_snapshot_record( struct ust_app_channel *ua_chan; struct ust_app_session *ua_sess; struct ust_registry_session *registry; - char *trace_path = NULL; char pathname[PATH_MAX]; ua_sess = lookup_session_by_app(usess, app); @@ -5988,6 +5989,8 @@ enum lttng_error_code ust_app_snapshot_record( PERROR("snprintf snapshot path"); goto error; } + /* Free path allowed on previous iteration. */ + free(trace_path); trace_path = setup_channel_trace_path(usess->consumer, pathname); if (!trace_path) { status = LTTNG_ERR_INVALID; @@ -6007,10 +6010,8 @@ enum lttng_error_code ust_app_snapshot_record( case LTTNG_OK: break; case LTTNG_ERR_CHAN_NOT_FOUND: - free(trace_path); continue; default: - free(trace_path); goto error; } } @@ -6025,7 +6026,6 @@ enum lttng_error_code ust_app_snapshot_record( ua_sess->effective_credentials.uid, ua_sess->effective_credentials.gid, trace_path, wait, 0); - free(trace_path); switch (status) { case LTTNG_OK: break; @@ -6043,6 +6043,7 @@ enum lttng_error_code ust_app_snapshot_record( } error: + free(trace_path); rcu_read_unlock(); return status; }