]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
CID 10 missing free(up); in refclock_palisade.c error return, again.
authorDave Hart <hart@ntp.org>
Sat, 19 Sep 2009 06:21:08 +0000 (06:21 +0000)
committerDave Hart <hart@ntp.org>
Sat, 19 Sep 2009 06:21:08 +0000 (06:21 +0000)
CID 83 added assertion to demonstrate config_nic_rules() does not
  call strchr(NULL, '/').

bk: 4ab47854LqWSJmOo1eZeyYFCOhZExQ

ChangeLog
ntpd/ntp_config.c
ntpd/refclock_palisade.c

index da392feb69e0c74d19b7ab69473bd1001b63bde9..6490075d625a0bc2a6a93a8c7a7dab63f0ac3f56 100644 (file)
--- 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 <stenn@ntp.org>
 * [Bug 1292] Workaround last VC6 unsigned __int64 kink.
 (4.2.5p214) 2009/09/17 Released by Harlan Stenn <stenn@ntp.org>
index 653bd4b038557c6aa07f440999d40038dcd01cf5..bb2330613ff2096bd14983b0cf6cd18df1bd6a0c 100644 (file)
@@ -2795,6 +2795,7 @@ config_nic_rules(
                        break;
 
                case 0:
+                       NTP_INSIST(if_name != NULL);
                        pchSlash = strchr(if_name, '/');
                        if (pchSlash != NULL)
                                *pchSlash = '\0';
index 2eb220acf18bc3914236fb63de6db4c8da129174..a50cc1ff8737fe342721863d7f8ab3f3566a28f7 100644 (file)
@@ -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;
        }