trace = _ltt_trace_find_setup(trace_name);
if(trace == NULL) {
ERR("cannot find trace!");
- ltt_unlock_traces();
retval = -1;
goto end;
}
ERR("unable to find channel");
}
- ltt_unlock_traces();
-
end:
+ ltt_unlock_traces();
return retval;
}
trace = _ltt_trace_find_setup(trace_name);
if(trace == NULL) {
ERR("cannot find trace!");
- ltt_unlock_traces();
retval = -1;
goto end;
}
ERR("unable to find channel");
}
- ltt_unlock_traces();
-
end:
+ ltt_unlock_traces();
return retval;
}
ltt_lock_traces();
trace = _ltt_trace_find(trace_name);
- ltt_unlock_traces();
if(trace == NULL) {
- char *reply;
int result;
WARN("Cannot find trace. It was likely destroyed by the user.");
- asprintf(&reply, "%s", "NOTFOUND");
- result = ustcomm_send_reply(&ustcomm_app.server, reply, src);
+ result = ustcomm_send_reply(&ustcomm_app.server, "NOTFOUND", src);
if(result) {
ERR("ustcomm_send_reply failed");
- free(reply);
retval = -1;
- goto free_short_chan_name;
+ goto unlock_traces;
}
- free(reply);
- goto free_short_chan_name;
+ goto unlock_traces;
}
for(i=0; i<trace->nr_channels; i++) {
bc = (struct blocked_consumer *) malloc(sizeof(struct blocked_consumer));
if(bc == NULL) {
ERR("malloc returned NULL");
- goto free_short_chan_name;
+ goto unlock_traces;
}
bc->fd_consumer = src->fd;
bc->fd_producer = buf->data_ready_fd_read;
ERR("unable to find channel");
}
+ unlock_traces:
+ ltt_unlock_traces();
+
free_short_chan_name:
free(ch_name);
ltt_lock_traces();
trace = _ltt_trace_find(trace_name);
- ltt_unlock_traces();
if(trace == NULL) {
WARN("Cannot find trace. It was likely destroyed by the user.");
- asprintf(&reply, "%s", "NOTFOUND");
- result = ustcomm_send_reply(&ustcomm_app.server, reply, src);
+ result = ustcomm_send_reply(&ustcomm_app.server, "NOTFOUND", src);
if(result) {
ERR("ustcomm_send_reply failed");
- free(reply);
retval = -1;
- goto free_short_chan_name;
+ goto unlock_traces;
}
- free(reply);
- goto free_short_chan_name;
+ goto unlock_traces;
}
for(i=0; i<trace->nr_channels; i++) {
ERR("ustcomm_send_reply failed");
free(reply);
retval = -1;
- goto free_channel_and_cpu;
+ goto unlock_traces;
}
free(reply);
ERR("unable to find channel");
}
+ unlock_traces:
+ ltt_unlock_traces();
free_short_chan_name:
free(ch_name);
free_consumed_old_str: