From: Abhimanyu Swami Date: Fri, 9 Aug 2024 10:26:55 +0000 (+0530) Subject: Hal allocation X-Git-Tag: accepted/tizen/unified/20241015.153113^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd7e26518ebd8ed43c6f08674e56a00604ba192f;p=platform%2Fhal%2Fapi%2Flocation.git Hal allocation Change-Id: Ib067863f9544a01fa44258d7dedda9da9cefaf32 --- diff --git a/packaging/hal-api-location.spec b/packaging/hal-api-location.spec index 61abe2a..5805e4d 100644 --- a/packaging/hal-api-location.spec +++ b/packaging/hal-api-location.spec @@ -5,7 +5,7 @@ ### main package ######### Name: %{name} Summary: %{name} interface -Version: 0.0.1 +Version: 0.0.2 Release: 1 Group: Development/Libraries License: Apache-2.0 diff --git a/src/hal-api-location.c b/src/hal-api-location.c index 7436d0c..f20f8a3 100644 --- a/src/hal-api-location.c +++ b/src/hal-api-location.c @@ -39,10 +39,16 @@ int hal_location_get_backend(void) if (g_hal_location_funcs) return 0; + g_hal_location_funcs = calloc(1, sizeof(hal_backend_location_funcs)); + if (!g_hal_location_funcs) + return -ENOMEM; + ret = hal_common_get_backend(HAL_MODULE_LOCATION, (void **)&g_hal_location_funcs); if (ret < 0) { + free(g_hal_location_funcs); + g_hal_location_funcs = NULL; _E("Failed to get backend\n"); - return -EINVAL; + return -ENOTSUP; } return 0; @@ -59,8 +65,10 @@ int hal_location_put_backend(void) ret = hal_common_put_backend(HAL_MODULE_LOCATION, (void *)g_hal_location_funcs); if (ret < 0) { _E("Failed to put backend\n"); - return -EINVAL; + return ret; } + + free(g_hal_location_funcs); g_hal_location_funcs = NULL; return 0;