]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1174] nmea_shutdown assumes that nmea has a unit assigned
authorDave Hart <hart@ntp.org>
Fri, 15 May 2009 19:54:46 +0000 (19:54 +0000)
committerDave Hart <hart@ntp.org>
Fri, 15 May 2009 19:54:46 +0000 (19:54 +0000)
bk: 4a0dc886Yc3RUBL50LmbO0N27A5Elw

ChangeLog
ntpd/refclock_nmea.c

index bed1efe168a92d9715af5f40d8ed1135fa79532c..d4a96f76783018c498281033dd9cc50240c9e9ba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+* [Bug 1174] nmea_shutdown assumes that nmea has a unit assigned
 * [Bug 1190] NMEA refclock fudge flag4 1 obscures position in timecode
 * Update NMEA refclock documentation in html/drivers/driver20.html
 (4.2.5p176) 2009/05/13 Released by Harlan Stenn <stenn@ntp.org>
index e207d17efbdb61eb8497acc21c5ac0d1301ca003..eb84be7fc7c91899e5ba47c95f0a570c613ac511 100644 (file)
@@ -30,6 +30,7 @@
 #endif /* HAVE_PPSAPI */
 
 #ifdef SYS_WINNT
+#undef write   /* ports/winnt/include/config.h: #define write _write */
 extern int async_write(int, const void *, unsigned int);
 #define write(fd, data, octets)        async_write(fd, data, octets)
 #endif
@@ -316,14 +317,17 @@ nmea_shutdown(
        register struct nmeaunit *up;
        struct refclockproc *pp;
 
+       UNUSED_ARG(unit);
+
        pp = peer->procptr;
        up = (struct nmeaunit *)pp->unitptr;
 #ifdef HAVE_PPSAPI
-       if (up->handle != 0)
+       if (NULL != up && up->handle)
                time_pps_destroy(up->handle);
 #endif /* HAVE_PPSAPI */
        io_closeclock(&pp->io);
-       free(up);
+       if (NULL != up)
+               free(up);
 }
 
 #ifdef HAVE_PPSAPI