From b944a4292d9ba21ea54ef9071dee0f66ef42ba4c Mon Sep 17 00:00:00 2001 From: David Anthony Date: Fri, 10 May 2024 10:52:07 -0500 Subject: [PATCH] Free GPS resource on stop (#106) --- gpsd_client/src/client.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gpsd_client/src/client.cpp b/gpsd_client/src/client.cpp index e87b36d..6f3ecab 100644 --- a/gpsd_client/src/client.cpp +++ b/gpsd_client/src/client.cpp @@ -12,7 +12,12 @@ using namespace sensor_msgs; class GPSDClient { public: - GPSDClient() : privnode("~"), gps(NULL), use_gps_time(true), check_fix_by_variance(true), frame_id("gps") {} + GPSDClient() : + privnode("~"), + gps(NULL), + use_gps_time(true), + check_fix_by_variance(true), + frame_id("gps") {} bool start() { gps_fix_pub = node.advertise("extended_fix", 1); @@ -73,6 +78,10 @@ class GPSDClient { void stop() { // gpsmm doesn't have a close method? OK ... + if (gps != NULL) + { + delete gps; + } } private: