fixed memory leak 72/122372/1 accepted/tizen_common accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable accepted/tizen/common/20170331.152752 accepted/tizen/mobile/20170331.083355 accepted/tizen/tv/20170331.083200 accepted/tizen/unified/20170331.083526 accepted/tizen/wearable/20170331.083314 submit/tizen/20170331.064133
authorjomui <jongmun.woo@samsung.com>
Fri, 31 Mar 2017 06:27:14 +0000 (15:27 +0900)
committerjomui <jongmun.woo@samsung.com>
Fri, 31 Mar 2017 06:27:36 +0000 (15:27 +0900)
Signed-off-by: jomui <jongmun.woo@samsung.com>
Change-Id: Ia5def29275d1b70a505bd73fe865352279dfca1f

src/mapzen/mapzen_jsonparser.cpp

index b39c372..07ac56a 100644 (file)
@@ -604,11 +604,6 @@ static void __parse_route_response(char *response, int size, int *status, mapzen
                return;
        }
        for (rapidjson::Value::ConstValueIterator leg = legs->value.Begin(); leg != legs->value.End(); ++leg) {
-               // Create segment response
-               mapzen_route_segment *segment_resp = (mapzen_route_segment *)g_malloc(sizeof(mapzen_route_segment));
-               segment_resp->maneuvers = NULL;
-               segment_resp->shapePoints = NULL;
-
                // Determine segment origin and destination
                coords_s segment_origin;
                coords_s segment_destination;
@@ -617,6 +612,11 @@ static void __parse_route_response(char *response, int size, int *status, mapzen
                        return;
                }
 
+               // Create segment response
+               mapzen_route_segment *segment_resp = (mapzen_route_segment *)g_malloc(sizeof(mapzen_route_segment));
+               segment_resp->maneuvers = NULL;
+               segment_resp->shapePoints = NULL;
+
                // Set segment origin
                segment_resp->origin = segment_origin;
                MAP_DEBUG(">>>>> PROCESS __parse_route_response: segment_origin: %f,%f", segment_origin.latitude, segment_origin.longitude);