1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 03:27:58 +03:00

Fix resouce leak in error path

If the error path of _register_for_event() calls _free_thread_status()
_lib_put() call is missing.
To make thing simpler move this _lib_put() into common error path code.
This commit is contained in:
Zdenek Kabelac 2010-03-30 14:37:28 +00:00
parent dee5782e76
commit 532142d214

View File

@ -243,8 +243,10 @@ static struct thread_status *_alloc_thread_status(struct message_data *data,
return ret;
}
static void _lib_put(struct dso_data *data);
static void _free_thread_status(struct thread_status *thread)
{
_lib_put(thread->dso_data);
if (thread->current_task)
dm_task_destroy(thread->current_task);
dm_free(thread->device.uuid);
@ -1481,7 +1483,6 @@ static void _cleanup_unused_threads(void)
if (thread->status == DM_THREAD_DONE) {
dm_list_del(l);
pthread_join(thread->thread, NULL);
_lib_put(thread->dso_data);
_free_thread_status(thread);
}
}