summaryrefslogtreecommitdiff
path: root/ntpshm.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-01-21 14:54:52 -0500
committerEric S. Raymond <esr@thyrsus.com>2015-01-21 14:54:52 -0500
commitaeb3bdae85bddab96c749dfc07ecf6d7e0b2fdf2 (patch)
tree5d5e3942e1d81ec3d3de8b1ca4d6bd3d4b305aba /ntpshm.c
parentcff19bf788a09366df98f24b66c20aca8450bd99 (diff)
downloadgpsd-aeb3bdae85bddab96c749dfc07ecf6d7e0b2fdf2.tar.gz
More splint cleanup. All regression tests pass.
Diffstat (limited to 'ntpshm.c')
-rw-r--r--ntpshm.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/ntpshm.c b/ntpshm.c
index 81f1778a..9ae0d491 100644
--- a/ntpshm.c
+++ b/ntpshm.c
@@ -220,6 +220,7 @@ static bool ntpshm_free(struct gps_context_t * context, volatile struct shmTime
void ntpshm_session_init(struct gps_device_t *session)
{
+ /*@-mustfreeonly@*/
#ifdef NTPSHM_ENABLE
/* mark NTPD shared memory segments as unused */
session->shm_clock = NULL;
@@ -227,6 +228,7 @@ void ntpshm_session_init(struct gps_device_t *session)
#ifdef PPS_ENABLE
session->shm_pps = NULL;
#endif /* PPS_ENABLE */
+ /*@+mustfreeonly@*/
}
int ntpshm_put(struct gps_device_t *session, volatile struct shmTime *shmseg, struct timedrift_t *td)
@@ -414,7 +416,8 @@ static /*@observer@*/ char *report_hook(struct gps_device_t *session,
log1 = "accepted chrony sock";
chrony_send(session, td);
}
- (void)ntpshm_put(session, session->shm_pps, td);
+ if (session->shm_pps != NULL)
+ (void)ntpshm_put(session, session->shm_pps, td);
return log1;
}
@@ -423,8 +426,10 @@ static /*@observer@*/ char *report_hook(struct gps_device_t *session,
void ntpshm_link_deactivate(struct gps_device_t *session)
/* release ntpshm storage for a session */
{
- (void)ntpshm_free(session->context, session->shm_clock);
- session->shm_clock = NULL;
+ if (session->shm_clock != NULL) {
+ (void)ntpshm_free(session->context, session->shm_clock);
+ session->shm_clock = NULL;
+ }
#if defined(PPS_ENABLE)
if (session->shm_pps != NULL) {
pps_thread_deactivate(session);