diff options
author | Robert Norris <rw_norris@hotmail.com> | 2016-07-30 18:08:40 +0000 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2016-08-02 16:55:34 -0700 |
commit | 5115c0b90e5d5a2cb2cb45761d0ae535e5b0be52 (patch) | |
tree | 0a9ef10fdbbe3f76e540307589aa8f4d498453ae /libgps_sock.c | |
parent | 471e144832d5d7404f18b94289d4c0c1d56defbc (diff) | |
download | gpsd-5115c0b90e5d5a2cb2cb45761d0ae535e5b0be52.tar.gz |
Prevent client crashes if one calls gps_close() multiple times
privdata must be explicitly set to NULL after use,
otherwise if gps_close() is (incorrectly) called again before
a new gps_open() then a double free condition can occur.
Signed-off-by: Gary E. Miller <gem@rellim.com>
Diffstat (limited to 'libgps_sock.c')
-rw-r--r-- | libgps_sock.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libgps_sock.c b/libgps_sock.c index a634e752..57da2f30 100644 --- a/libgps_sock.c +++ b/libgps_sock.c @@ -119,6 +119,7 @@ int gps_sock_close(struct gps_data_t *gpsdata) int status; free(PRIVATE(gpsdata)); + gpsdata->privdata = NULL; status = close(gpsdata->gps_fd); gpsdata->gps_fd = -1; return status; |