From b6bfe57d7a512928bed9f0671d5d484300161557 Mon Sep 17 00:00:00 2001 From: Priya Kohli Date: Thu, 24 Oct 2024 14:44:18 +0530 Subject: [PATCH] [lbs-server-plugin-replay] TNINE-4922 : Asan fix for heap-use-after-free in lbs-server on RPI4 Change-Id: I501ff6aea55f034f4d3d8cb26e85a5b033b3caba Signed-off-by: Priya Kohli --- gps-plugin/src/gps_plugin_replay.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gps-plugin/src/gps_plugin_replay.c b/gps-plugin/src/gps_plugin_replay.c index 143ef8f..f2f67b1 100755 --- a/gps-plugin/src/gps_plugin_replay.c +++ b/gps-plugin/src/gps_plugin_replay.c @@ -728,7 +728,11 @@ static int gps_plugin_replay_gps_request(gps_action_t gps_action, void *gps_acti display_mode_changed(); break; case GPS_INDI_SUPL_DNSQUERY: - nmea_file_name = *(const char**)(gps_action_data); + if (nmea_file_name) { + free(nmea_file_name); + nmea_file_name = NULL; + } + nmea_file_name = strdup(*(const char**)(gps_action_data)); break; case GPS_ACTION_START_FACTTEST: g_replay_timer->replay_mode = *(int*)(gps_action_data); @@ -767,6 +771,10 @@ static int location_init(void **data) static int location_exit(void *data) { + if (nmea_file_name) { + free(nmea_file_name); + nmea_file_name = NULL; + } return 0; } -- 2.34.1