projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: lttng_trace_archive_location_serialize is called on freed memory
[lttng-tools.git]
/
src
/
lib
/
lttng-ctl
/
destruction-handle.c
diff --git
a/src/lib/lttng-ctl/destruction-handle.c
b/src/lib/lttng-ctl/destruction-handle.c
index c6bb388ebcab793a97badf56e283c832f84b5378..6d8a26b113481914ff01e8e691d23eec23699750 100644
(file)
--- a/
src/lib/lttng-ctl/destruction-handle.c
+++ b/
src/lib/lttng-ctl/destruction-handle.c
@@
-56,10
+56,10
@@
void lttng_destruction_handle_destroy(struct lttng_destruction_handle *handle)
if (ret) {
PERROR("Failed to close lttng-sessiond command socket");
}
if (ret) {
PERROR("Failed to close lttng-sessiond command socket");
}
-
}
-
lttng_poll_clean(&handle->communication.events);
+ }
+ lttng_poll_clean(&handle->communication.events);
lttng_dynamic_buffer_reset(&handle->communication.buffer);
lttng_dynamic_buffer_reset(&handle->communication.buffer);
- lttng_trace_archive_location_
destroy
(handle->location);
+ lttng_trace_archive_location_
put
(handle->location);
free(handle);
}
free(handle);
}
@@
-82,9
+82,9
@@
struct lttng_destruction_handle *lttng_destruction_handle_create(
ret = lttng_poll_add(&handle->communication.events, sessiond_socket,
LPOLLIN | LPOLLHUP | LPOLLRDHUP | LPOLLERR);
ret = lttng_poll_add(&handle->communication.events, sessiond_socket,
LPOLLIN | LPOLLHUP | LPOLLRDHUP | LPOLLERR);
-
if (ret) {
+ if (ret) {
goto error;
goto error;
-
}
+ }
handle->communication.bytes_left_to_receive =
sizeof(struct lttcomm_lttng_msg);
handle->communication.bytes_left_to_receive =
sizeof(struct lttcomm_lttng_msg);
@@
-173,6
+173,7
@@
int handle_state_transition(struct lttng_destruction_handle *handle)
ret = -1;
break;
} else {
ret = -1;
break;
} else {
+ /* Ownership is transferred to the destruction handle. */
handle->location = location;
handle->communication.state = COMMUNICATION_STATE_END;
}
handle->location = location;
handle->communication.state = COMMUNICATION_STATE_END;
}
@@
-227,43
+228,42
@@
enum lttng_destruction_handle_status
lttng_destruction_handle_wait_for_completion(
struct lttng_destruction_handle *handle, int timeout_ms)
{
lttng_destruction_handle_wait_for_completion(
struct lttng_destruction_handle *handle, int timeout_ms)
{
- int ret;
enum lttng_destruction_handle_status status;
unsigned long time_left_ms = 0;
const bool has_timeout = timeout_ms > 0;
enum lttng_destruction_handle_status status;
unsigned long time_left_ms = 0;
const bool has_timeout = timeout_ms > 0;
-
struct timespec initial_time;
+ struct timespec initial_time;
if (!handle) {
status = LTTNG_DESTRUCTION_HANDLE_STATUS_INVALID;
goto end;
}
if (!handle) {
status = LTTNG_DESTRUCTION_HANDLE_STATUS_INVALID;
goto end;
}
-
if (handle->communication.state == COMMUNICATION_STATE_ERROR) {
+ if (handle->communication.state == COMMUNICATION_STATE_ERROR) {
status = LTTNG_DESTRUCTION_HANDLE_STATUS_ERROR;
goto end;
} else if (handle->communication.state == COMMUNICATION_STATE_END) {
status = LTTNG_DESTRUCTION_HANDLE_STATUS_COMPLETED;
goto end;
}
status = LTTNG_DESTRUCTION_HANDLE_STATUS_ERROR;
goto end;
} else if (handle->communication.state == COMMUNICATION_STATE_END) {
status = LTTNG_DESTRUCTION_HANDLE_STATUS_COMPLETED;
goto end;
}
-
if (has_timeout) {
- ret = lttng_clock_gettime(CLOCK_MONOTONIC, &initial_time);
+ if (has_timeout) {
+
int
ret = lttng_clock_gettime(CLOCK_MONOTONIC, &initial_time);
if (ret) {
status = LTTNG_DESTRUCTION_HANDLE_STATUS_ERROR;
goto end;
}
time_left_ms = (unsigned long) timeout_ms;
if (ret) {
status = LTTNG_DESTRUCTION_HANDLE_STATUS_ERROR;
goto end;
}
time_left_ms = (unsigned long) timeout_ms;
-
}
+ }
-
while (handle->communication.state != COMMUNICATION_STATE_END &&
+ while (handle->communication.state != COMMUNICATION_STATE_END &&
(time_left_ms || !has_timeout)) {
int ret;
uint32_t revents;
(time_left_ms || !has_timeout)) {
int ret;
uint32_t revents;
-
struct timespec current_time, diff;
+ struct timespec current_time, diff;
unsigned long diff_ms;
unsigned long diff_ms;
-
ret = lttng_poll_wait(&handle->communication.events,
+ ret = lttng_poll_wait(&handle->communication.events,
has_timeout ? time_left_ms : -1);
has_timeout ? time_left_ms : -1);
-
if (ret == 0) {
+ if (ret == 0) {
/* timeout */
break;
} else if (ret < 0) {
/* timeout */
break;
} else if (ret < 0) {
@@
-388,13
+388,13
@@
enum lttng_error_code lttng_destroy_session_ext(const char *session_name,
int ret;
ssize_t comm_ret;
enum lttng_error_code ret_code = LTTNG_OK;
int ret;
ssize_t comm_ret;
enum lttng_error_code ret_code = LTTNG_OK;
-
struct lttcomm_session_msg lsm = {
+ struct lttcomm_session_msg lsm = {
.cmd_type = LTTNG_DESTROY_SESSION,
};
int sessiond_socket = -1;
struct lttng_destruction_handle *handle = NULL;
.cmd_type = LTTNG_DESTROY_SESSION,
};
int sessiond_socket = -1;
struct lttng_destruction_handle *handle = NULL;
- if (!session_name
|| !_handle
) {
+ if (!session_name) {
ret_code = LTTNG_ERR_INVALID;
goto error;
}
ret_code = LTTNG_ERR_INVALID;
goto error;
}
This page took
0.02633 seconds
and
4
git commands to generate.