[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gpsd-dev] [PATCH] Improved resilience in gps_shm_close() in case it is
From: |
Robert Norris |
Subject: |
[gpsd-dev] [PATCH] Improved resilience in gps_shm_close() in case it is called after an unsuccessful gps_shm_open() |
Date: |
Mon, 1 Aug 2016 19:08:04 +0000 |
Check that the structure exists before trying to use a component of it.
---
libgps_shm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libgps_shm.c b/libgps_shm.c
index b256249..e0aa3ab 100644
--- a/libgps_shm.c
+++ b/libgps_shm.c
@@ -153,7 +153,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);
}
--
2.8.1