From b27acd687800499324381648036edd098c996524 Mon Sep 17 00:00:00 2001 From: Jon Lund Steffensen Date: Wed, 11 Oct 2017 20:36:41 -0700 Subject: Allocate module data in init functions --- src/location-geoclue2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/location-geoclue2.c') diff --git a/src/location-geoclue2.c b/src/location-geoclue2.c index b012da4..0bb1024 100644 --- a/src/location-geoclue2.c +++ b/src/location-geoclue2.c @@ -325,11 +325,13 @@ run_geoclue2_loop(void *state_) } static int -location_geoclue2_init(location_geoclue2_state_t *state) +location_geoclue2_init(location_geoclue2_state_t **state) { #if !GLIB_CHECK_VERSION(2, 35, 0) g_type_init(); #endif + *state = malloc(sizeof(location_geoclue2_state_t)); + if (*state == NULL) return -1; return 0; } @@ -374,6 +376,8 @@ location_geoclue2_free(location_geoclue2_state_t *state) state->thread = NULL; g_mutex_clear(&state->lock); + + free(state); } static void -- cgit v1.2.3-70-g09d2