From: jomui Date: Thu, 26 Jan 2017 01:25:10 +0000 (+0900) Subject: [UTC][cai-maps-service][NON-ACR][fix memory leak:TSAM-12731] X-Git-Tag: 4.0_Bringup~74^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d9880746ffcebe2cb885a0b90a80ad69aa5887ab;p=test%2Ftct%2Fnative%2Fapi.git [UTC][cai-maps-service][NON-ACR][fix memory leak:TSAM-12731] Change-Id: I92b140e86da6b166ba831f2fc7103ad2e06b712a Signed-off-by: jomui --- diff --git a/src/utc/capi-maps-service/utc_maps_service_here.c b/src/utc/capi-maps-service/utc_maps_service_here.c index 3f36190ba..dd0d270a3 100755 --- a/src/utc/capi-maps-service/utc_maps_service_here.c +++ b/src/utc/capi-maps-service/utc_maps_service_here.c @@ -82,6 +82,7 @@ void utc_maps_service_cleanup(void) static gboolean timeout_func(gpointer data) { g_main_loop_quit((GMainLoop *) data); + g_main_loop_unref((GMainLoop *) data); return FALSE; } @@ -99,6 +100,7 @@ static void quit_for_service(void) { if (mainloop) { g_main_loop_quit(mainloop); + g_main_loop_unref(mainloop); mainloop = NULL; } } @@ -609,6 +611,10 @@ int utc_maps_service_geocode_inside_area_p(void) assert(bottom_right); ret = maps_area_create_rectangle(top_left, bottom_right, &boundary); + + maps_coordinates_destroy(top_left); + maps_coordinates_destroy(bottom_right); + assert_eq(ret, MAPS_ERROR_NONE); assert(boundary); @@ -620,15 +626,11 @@ int utc_maps_service_geocode_inside_area_p(void) assert(service_available); service_available = false; - ret = maps_coordinates_destroy(top_left); - assert_eq(ret, MAPS_ERROR_NONE); - - ret = maps_coordinates_destroy(bottom_right); - assert_eq(ret, MAPS_ERROR_NONE); - ret = maps_area_destroy(boundary); assert_eq(ret, MAPS_ERROR_NONE); } else { + maps_area_destroy(boundary); + assert_eq(ret, MAPS_ERROR_NOT_SUPPORTED); } } else { @@ -713,11 +715,11 @@ int utc_maps_service_geocode_by_structured_address_p(void) assert_eq(ret, MAPS_ERROR_NONE); assert(address); - maps_address_set_city(address, "Berlin"); + ret = maps_address_set_city(address, "Berlin"); assert_eq(ret, MAPS_ERROR_NONE); - /* maps_address_set_street(address, "Rosa-Luxemburg"); */ + /* ret= maps_address_set_street(address, "Rosa-Luxemburg"); */ /* assert_eq(ret, MAPS_ERROR_NONE); */ - /* maps_address_set_building_number(address, "13"); */ + /* ret = maps_address_set_building_number(address, "13"); */ /* assert_eq(ret, MAPS_ERROR_NONE); */ ret = maps_service_geocode_by_structured_address(__pMaps, address, __preference, __utc_maps_location_foreach_cb, NULL, &request_id); @@ -731,6 +733,7 @@ int utc_maps_service_geocode_by_structured_address_p(void) ret = maps_address_destroy(address); assert_eq(ret, MAPS_ERROR_NONE); } else { + maps_address_destroy(address); assert_eq(ret, MAPS_ERROR_NOT_SUPPORTED); } } else { diff --git a/src/utc/capi-maps-service/utc_maps_service_mapzen.c b/src/utc/capi-maps-service/utc_maps_service_mapzen.c index 136740ea1..930b100d0 100755 --- a/src/utc/capi-maps-service/utc_maps_service_mapzen.c +++ b/src/utc/capi-maps-service/utc_maps_service_mapzen.c @@ -82,6 +82,7 @@ void utc_maps_service_cleanup2(void) static gboolean timeout_func(gpointer data) { g_main_loop_quit((GMainLoop *) data); + g_main_loop_unref((GMainLoop *) data); return FALSE; } @@ -99,6 +100,7 @@ static void quit_for_service(void) { if (mainloop) { g_main_loop_quit(mainloop); + g_main_loop_unref(mainloop); mainloop = NULL; } } @@ -609,6 +611,10 @@ int utc_maps_service_geocode_inside_area_p2(void) assert(bottom_right); ret = maps_area_create_rectangle(top_left, bottom_right, &boundary); + + maps_coordinates_destroy(top_left); + maps_coordinates_destroy(bottom_right); + assert_eq(ret, MAPS_ERROR_NONE); assert(boundary); @@ -620,15 +626,11 @@ int utc_maps_service_geocode_inside_area_p2(void) assert(service_available); service_available = false; - ret = maps_coordinates_destroy(top_left); - assert_eq(ret, MAPS_ERROR_NONE); - - ret = maps_coordinates_destroy(bottom_right); - assert_eq(ret, MAPS_ERROR_NONE); - ret = maps_area_destroy(boundary); assert_eq(ret, MAPS_ERROR_NONE); } else { + maps_area_destroy(boundary); + assert_eq(ret, MAPS_ERROR_NOT_SUPPORTED); } } else { @@ -713,7 +715,7 @@ int utc_maps_service_geocode_by_structured_address_p2(void) assert_eq(ret, MAPS_ERROR_NONE); assert(address); - maps_address_set_city(address, "Berlin"); + ret = maps_address_set_city(address, "Berlin"); assert_eq(ret, MAPS_ERROR_NONE); /* maps_address_set_street(address, "Rosa-Luxemburg"); */ /* assert_eq(ret, MAPS_ERROR_NONE); */ @@ -731,6 +733,7 @@ int utc_maps_service_geocode_by_structured_address_p2(void) ret = maps_address_destroy(address); assert_eq(ret, MAPS_ERROR_NONE); } else { + maps_address_destroy(address); assert_eq(ret, MAPS_ERROR_NOT_SUPPORTED); } } else { diff --git a/src/utc/capi-maps-service/utc_maps_utils.c b/src/utc/capi-maps-service/utc_maps_utils.c index 7dc4fffb9..c21d58679 100755 --- a/src/utc/capi-maps-service/utc_maps_utils.c +++ b/src/utc/capi-maps-service/utc_maps_utils.c @@ -36,7 +36,7 @@ bool _is_internet_feature_supported(void) int ret = system_info_get_platform_string("http://tizen.org/feature/profile", &profile); if (ret == SYSTEM_INFO_ERROR_NONE && profile && *profile) { if (!strcmp("wearable", profile)) - ret = system_info_get_platform_bool("http://tizen.org/feature/network.internet", &__is_supported); + system_info_get_platform_bool("http://tizen.org/feature/network.internet", &__is_supported); } if (profile) free(profile); diff --git a/src/utc/capi-maps-service/utc_maps_view_object_common.c b/src/utc/capi-maps-service/utc_maps_view_object_common.c index 03a88bb7e..c24b806af 100755 --- a/src/utc/capi-maps-service/utc_maps_view_object_common.c +++ b/src/utc/capi-maps-service/utc_maps_view_object_common.c @@ -133,6 +133,9 @@ int utc_maps_view_object_create_marker_p(void) ret = maps_view_object_marker_get_image_file(marker, &file_path); ASSERT_IF_VAL_REF2(ret, is_maps_supported, MAPS_ERROR_NONE, MAPS_ERROR_NOT_SUPPORTED); + free(file_path); + file_path = NULL; + ret = maps_view_object_marker_get_size(marker, &width, &height); ASSERT_IF_VAL_REF2(ret, is_maps_supported, MAPS_ERROR_NONE, MAPS_ERROR_NOT_SUPPORTED); @@ -482,10 +485,12 @@ int utc_maps_view_object_marker_get_image_file_n(void) ret = maps_view_object_marker_get_image_file(NULL, &file_path); ASSERT_IF_VAL_REF2(ret, is_maps_supported, MAPS_ERROR_INVALID_PARAMETER, MAPS_ERROR_NOT_SUPPORTED); + free(file_path); + file_path = NULL; + ret = maps_view_object_marker_get_image_file(marker, NULL); ASSERT_IF_VAL_REF2(ret, is_maps_supported, MAPS_ERROR_INVALID_PARAMETER, MAPS_ERROR_NOT_SUPPORTED); - ret = maps_view_object_destroy(marker); ASSERT_IF_VAL_REF2(ret, is_maps_supported, MAPS_ERROR_NONE, MAPS_ERROR_NOT_SUPPORTED);