fix a memory leak in new_fluid_thread()

This commit is contained in:
derselbst 2019-03-15 20:30:02 +01:00
parent 8f3af98a94
commit 89ffe5881d

View file

@ -945,7 +945,7 @@ fluid_thread_t *
new_fluid_thread(const char *name, fluid_thread_func_t func, void *data, int prio_level, int detach) new_fluid_thread(const char *name, fluid_thread_func_t func, void *data, int prio_level, int detach)
{ {
GThread *thread; GThread *thread;
fluid_thread_info_t *info; fluid_thread_info_t *info = NULL;
GError *err = NULL; GError *err = NULL;
g_return_val_if_fail(func != NULL, NULL); g_return_val_if_fail(func != NULL, NULL);
@ -982,25 +982,21 @@ new_fluid_thread(const char *name, fluid_thread_func_t func, void *data, int pri
#endif #endif
} }
else
{
#if NEW_GLIB_THREAD_API #if NEW_GLIB_THREAD_API
else
{
thread = g_thread_try_new(name, (GThreadFunc)func, data, &err); thread = g_thread_try_new(name, (GThreadFunc)func, data, &err);
}
#else #else
else
{
thread = g_thread_create((GThreadFunc)func, data, detach == FALSE, &err); thread = g_thread_create((GThreadFunc)func, data, detach == FALSE, &err);
}
#endif #endif
}
if(!thread) if(!thread)
{ {
FLUID_LOG(FLUID_ERR, "Failed to create the thread: %s", FLUID_LOG(FLUID_ERR, "Failed to create the thread: %s",
fluid_gerror_message(err)); fluid_gerror_message(err));
g_clear_error(&err); g_clear_error(&err);
FLUID_FREE(info);
return NULL; return NULL;
} }