From: Dave Hart Date: Sat, 19 Sep 2009 06:21:08 +0000 (+0000) Subject: CID 10 missing free(up); in refclock_palisade.c error return, again. X-Git-Tag: NTP_4_2_5P216~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3759206be1e9b63bd037bbc390b95a171fbc368;p=thirdparty%2Fntp.git CID 10 missing free(up); in refclock_palisade.c error return, again. CID 83 added assertion to demonstrate config_nic_rules() does not call strchr(NULL, '/'). bk: 4ab47854LqWSJmOo1eZeyYFCOhZExQ --- diff --git a/ChangeLog b/ChangeLog index da392feb6..6490075d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ * [Bug 1312] ntpq/ntpdc MD5 passwords truncated to 8 chars on Suns. +* CID 10 missing free(up); in refclock_palisade.c error return, again. +* CID 83 added assertion to demonstrate config_nic_rules() does not + call strchr(NULL, '/'). (4.2.5p215) 2009/09/18 Released by Harlan Stenn * [Bug 1292] Workaround last VC6 unsigned __int64 kink. (4.2.5p214) 2009/09/17 Released by Harlan Stenn diff --git a/ntpd/ntp_config.c b/ntpd/ntp_config.c index 653bd4b03..bb2330613 100644 --- a/ntpd/ntp_config.c +++ b/ntpd/ntp_config.c @@ -2795,6 +2795,7 @@ config_nic_rules( break; case 0: + NTP_INSIST(if_name != NULL); pchSlash = strchr(if_name, '/'); if (pchSlash != NULL) *pchSlash = '\0'; diff --git a/ntpd/refclock_palisade.c b/ntpd/refclock_palisade.c index 2eb220acf..a50cc1ff8 100644 --- a/ntpd/refclock_palisade.c +++ b/ntpd/refclock_palisade.c @@ -298,6 +298,7 @@ palisade_start ( #ifdef DEBUG printf("Palisade(%d) tcgetattr(fd, &tio)\n",unit); #endif + close(fd); return (0); } @@ -309,15 +310,6 @@ palisade_start ( */ up = (struct palisade_unit *) emalloc(sizeof(struct palisade_unit)); - if (!(up)) { - msyslog(LOG_ERR, "Palisade(%d) emalloc: %m",unit); -#ifdef DEBUG - printf("Palisade(%d) emalloc\n",unit); -#endif - (void) close(fd); - return (0); - } - memset((char *)up, 0, sizeof(struct palisade_unit)); up->type = CLK_TYPE(peer); @@ -347,6 +339,8 @@ palisade_start ( #ifdef DEBUG printf("Palisade(%d) tcsetattr(fd, &tio)\n",unit); #endif + close(fd); + free(up); return 0; }