summaryrefslogtreecommitdiff
path: root/libgps_shm.c
diff options
context:
space:
mode:
authorRobert Norris <rw_norris@hotmail.com>2016-07-30 18:08:40 +0000
committerGary E. Miller <gem@rellim.com>2016-08-02 16:55:34 -0700
commit5115c0b90e5d5a2cb2cb45761d0ae535e5b0be52 (patch)
tree0a9ef10fdbbe3f76e540307589aa8f4d498453ae /libgps_shm.c
parent471e144832d5d7404f18b94289d4c0c1d56defbc (diff)
downloadgpsd-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_shm.c')
-rw-r--r--libgps_shm.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libgps_shm.c b/libgps_shm.c
index b256249f..a0dfdde1 100644
--- a/libgps_shm.c
+++ b/libgps_shm.c
@@ -60,6 +60,7 @@ int gps_shm_open(struct gps_data_t *gpsdata)
if (PRIVATE(gpsdata)->shmseg == (void *) -1) {
/* attach failed for sume unknown reason */
free(gpsdata->privdata);
+ gpsdata->privdata = NULL;
return -2;
}
#ifndef USE_QT