diff options
author | Robert Norris <rw_norris@hotmail.com> | 2016-08-01 19:08:04 +0000 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2016-08-02 17:00:03 -0700 |
commit | 676bfdcfba30a56640705b72e3c436c0fe67af74 (patch) | |
tree | 9b1b7dab3c7ce07b7cc43b4c3d774ed587b6016f /libgps_shm.c | |
parent | b58149667db53dcd513b457f9da77bd38a258a08 (diff) | |
download | gpsd-676bfdcfba30a56640705b72e3c436c0fe67af74.tar.gz |
Improved resilience in gps_shm_close() in case it is called after an unsuccessful gps_shm_open()
Check that the structure exists before trying to use a component of it.
Signed-off-by: Gary E. Miller <gem@rellim.com>
Diffstat (limited to 'libgps_shm.c')
-rw-r--r-- | libgps_shm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libgps_shm.c b/libgps_shm.c index a0dfdde1..75aba8aa 100644 --- a/libgps_shm.c +++ b/libgps_shm.c @@ -154,7 +154,7 @@ int gps_shm_read(struct gps_data_t *gpsdata) void gps_shm_close(struct gps_data_t *gpsdata) { - if (PRIVATE(gpsdata)->shmseg != NULL) + if (PRIVATE(gpsdata) && PRIVATE(gpsdata)->shmseg != NULL) (void)shmdt((const void *)PRIVATE(gpsdata)->shmseg); } |