From 9c2ddcf622477d3c6876efb744078db05b03d8cc Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Mon, 23 Apr 2007 15:06:03 +0000 Subject: [PATCH] Fix some memory leaks in dmeventd. --- WHATS_NEW | 2 +- dmeventd/dmeventd.c | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 02d1bda..76559f2 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,7 +1,7 @@ Version 1.02.19 - ==================================== Introduce _add_field() and _is_same_field() to libdm-report.c. - Fix some libdevmapper-event memory leaks. + Fix some libdevmapper-event and dmeventd memory leaks. Remove unnecessary memset() return value checks. Fix a few leaks in reporting error paths. [1.02.15+] diff --git a/dmeventd/dmeventd.c b/dmeventd/dmeventd.c index 999a936..fab7dd5 100644 --- a/dmeventd/dmeventd.c +++ b/dmeventd/dmeventd.c @@ -245,6 +245,8 @@ static struct thread_status *_alloc_thread_status(struct message_data *data, static void _free_thread_status(struct thread_status *thread) { + if (thread->current_task) + dm_task_destroy(thread->current_task); dm_free(thread->device.uuid); dm_free(thread->device.name); dm_free(thread); @@ -811,11 +813,6 @@ static int _create_thread(struct thread_status *thread) static int _terminate_thread(struct thread_status *thread) { - int ret; - - if ((ret = pthread_cancel(thread->thread))) - return ret; - return pthread_kill(thread->thread, SIGALRM); } @@ -1389,7 +1386,7 @@ static int _do_process_request(struct dm_event_daemon_message *msg) message_data.msg = msg; if (msg->cmd == DM_EVENT_CMD_HELLO) { ret = 0; - answer = dm_strdup(msg->data); + answer = msg->data; if (answer) { msg->size = dm_asprintf(&(msg->data), "%s HELLO", answer); dm_free(answer); -- 2.43.5