diff options
author | Robert Norris <rw_norris@hotmail.com> | 2017-02-02 23:39:03 +0000 |
---|---|---|
committer | Fred Wright <fw@fwright.net> | 2017-02-02 19:16:44 -0800 |
commit | 3ae82ee27f38343e7982c6e96db0cdcd80a851b5 (patch) | |
tree | e4e57bd017ca743f7a8b0d9a92846c4779a8e37d /libgps_sock.c | |
parent | 260ed80ab2e8e18ae208d34b6e8ad3b784155d62 (diff) | |
download | gpsd-3ae82ee27f38343e7982c6e96db0cdcd80a851b5.tar.gz |
Fix memory leak in Qt build.
Since privdata is always allocated in gps_sock_open(),
it always needs to be free'd in gps_sock_close().
Signed-off-by: Fred Wright <fw@fwright.net>
Diffstat (limited to 'libgps_sock.c')
-rw-r--r-- | libgps_sock.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libgps_sock.c b/libgps_sock.c index 57da2f30..ea04b8cd 100644 --- a/libgps_sock.c +++ b/libgps_sock.c @@ -115,11 +115,10 @@ bool gps_sock_waiting(const struct gps_data_t *gpsdata, int timeout) int gps_sock_close(struct gps_data_t *gpsdata) /* close a gpsd connection */ { -#ifndef USE_QT - int status; - free(PRIVATE(gpsdata)); gpsdata->privdata = NULL; +#ifndef USE_QT + int status; status = close(gpsdata->gps_fd); gpsdata->gps_fd = -1; return status; |