From: Dave Hart Date: Fri, 15 May 2009 19:54:46 +0000 (+0000) Subject: [Bug 1174] nmea_shutdown assumes that nmea has a unit assigned X-Git-Tag: NTP_4_2_5P177~2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3110c25db138cdbde19a4ccb8dce7b537c585f7e;p=thirdparty%2Fntp.git [Bug 1174] nmea_shutdown assumes that nmea has a unit assigned bk: 4a0dc886Yc3RUBL50LmbO0N27A5Elw --- diff --git a/ChangeLog b/ChangeLog index bed1efe16..d4a96f767 100644 --- 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 diff --git a/ntpd/refclock_nmea.c b/ntpd/refclock_nmea.c index e207d17ef..eb84be7fc 100644 --- a/ntpd/refclock_nmea.c +++ b/ntpd/refclock_nmea.c @@ -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