[UTC][cai-maps-service][NON-ACR][fix memory leak:TSAM-12731]
authorjomui <jongmun.woo@samsung.com>
Thu, 26 Jan 2017 01:25:10 +0000 (10:25 +0900)
committerjomui <jongmun.woo@samsung.com>
Thu, 26 Jan 2017 01:25:10 +0000 (10:25 +0900)
Change-Id: I92b140e86da6b166ba831f2fc7103ad2e06b712a
Signed-off-by: jomui <jongmun.woo@samsung.com>
src/utc/capi-maps-service/utc_maps_service_here.c
src/utc/capi-maps-service/utc_maps_service_mapzen.c
src/utc/capi-maps-service/utc_maps_utils.c
src/utc/capi-maps-service/utc_maps_view_object_common.c

index 3f36190ba4c74baf7294fa5ec0908565be6c1e0e..dd0d270a3ef2d1bb64b2dcaad7ca6fdc6a6e758b 100755 (executable)
@@ -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 {
index 136740ea18e768e70a9646fc49716e1a872cad17..930b100d02dcf48a87ee49de2106c5001d3ce04d 100755 (executable)
@@ -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 {
index 7dc4fffb99515f522244a67873412744d1db1ec7..c21d586793ccd3a9f0d4f1d45352d81dc79c056d 100755 (executable)
@@ -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);
index 03a88bb7ed336e9c2eb9060027b46cf927b36683..c24b806af9cda6bacb636d1a78fda01e9142339a 100755 (executable)
@@ -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);