[location-manager] Memory Leak fix 95/320295/1 accepted/tizen_unified accepted/tizen_unified_x accepted/tizen_unified_x_asan tizen accepted/tizen/unified/20241113.042411 accepted/tizen/unified/x/20241218.032924 accepted/tizen/unified/x/asan/20241224.004702
authorPriya Kohli <priya.kohli@samsung.com>
Tue, 12 Nov 2024 10:38:28 +0000 (16:08 +0530)
committerPriya Kohli <priya.kohli@samsung.com>
Tue, 12 Nov 2024 10:38:28 +0000 (16:08 +0530)
Change-Id: I810cd07dfb1aa0b8892a1247c7c9d9769e08e56e
Signed-off-by: Priya Kohli <priya.kohli@samsung.com>
src/locations.c

index 62cae97a74c2b47c9c271a72a2f8fc7023998d92..138aec90653141fa9066154e3a2ce7ecbc0ac1b3 100755 (executable)
@@ -826,6 +826,9 @@ EXPORT_API int location_manager_get_location(location_manager_h manager, double
                return __convert_error_code(ret);       //LCOV_EXCL_LINE
 
        if (pos->status == LOCATION_STATUS_NO_FIX) {
+               location_position_free(pos);
+               location_velocity_free(vel);
+               location_accuracy_free(acc);
                return __convert_error_code(LOCATION_ERROR_NOT_AVAILABLE);      //LCOV_EXCL_LINE
        } else {
                *latitude = pos->latitude;