Skip to content

Commit f4ed88e

Browse files
committed
mainloop/gattlib_glib_mainloop: Fix non initialized variable
1 parent aaab2dc commit f4ed88e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

common/mainloop/gattlib_glib_mainloop.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,18 @@ int gattlib_mainloop(void* (*task)(void* arg), void *arg) {
3434
GError* error;
3535

3636
if (m_main_loop != NULL) {
37-
GATTLIB_LOG(GATTLIB_ERROR, "Main loop is already running: %s", error->message);
38-
g_error_free(error);
37+
GATTLIB_LOG(GATTLIB_ERROR, "Main loop is already running");
3938
return GATTLIB_BUSY;
4039
}
4140

4241
m_main_loop = g_main_loop_new(NULL, FALSE);
4342

4443
GThread *task_thread = g_thread_try_new("gattlib_task", _execute_task, &execute_task_arg, &error);
44+
if (task_thread == NULL) {
45+
GATTLIB_LOG(GATTLIB_ERROR, "Could not create task for main loop: %s", error->message);
46+
g_error_free(error);
47+
return GATTLIB_UNEXPECTED;
48+
}
4549

4650
g_main_loop_run(m_main_loop);
4751
g_main_loop_unref(m_main_loop);

0 commit comments

Comments
 (0)