Skip to content

Commit b944a42

Browse files
authored
Free GPS resource on stop (#106)
1 parent a07f8d9 commit b944a42

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

gpsd_client/src/client.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ using namespace sensor_msgs;
1212

1313
class GPSDClient {
1414
public:
15-
GPSDClient() : privnode("~"), gps(NULL), use_gps_time(true), check_fix_by_variance(true), frame_id("gps") {}
15+
GPSDClient() :
16+
privnode("~"),
17+
gps(NULL),
18+
use_gps_time(true),
19+
check_fix_by_variance(true),
20+
frame_id("gps") {}
1621

1722
bool start() {
1823
gps_fix_pub = node.advertise<GPSFix>("extended_fix", 1);
@@ -73,6 +78,10 @@ class GPSDClient {
7378

7479
void stop() {
7580
// gpsmm doesn't have a close method? OK ...
81+
if (gps != NULL)
82+
{
83+
delete gps;
84+
}
7685
}
7786

7887
private:

0 commit comments

Comments
 (0)