From: Harlan Stenn Date: Sun, 15 Jul 2012 06:46:24 +0000 (-0700) Subject: CID 709185: refclock_chu.c will leak fd==0 (which should be impossible) X-Git-Tag: NTP_4_2_7P289~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d75a4f80bddc0dcf8913cdaa5b9a1773b22f4bbc;p=thirdparty%2Fntp.git CID 709185: refclock_chu.c will leak fd==0 (which should be impossible) bk: 50026740AlMejDWW-NVg9WVWs6frbw --- diff --git a/ChangeLog b/ChangeLog index 9f1d15fe6..ba090da6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* CID 709185: refclock_chu.c will leak fd==0 (which should be impossible). (4.2.7p288) 2012/07/03 Released by Harlan Stenn * CID 709173: Make sure a libisc function we do not use is called properly. (4.2.7p287) 2012/07/03 Released by Harlan Stenn diff --git a/ntpd/refclock_chu.c b/ntpd/refclock_chu.c index fd9513afa..48b67536f 100644 --- a/ntpd/refclock_chu.c +++ b/ntpd/refclock_chu.c @@ -480,6 +480,17 @@ chu_start( * Open audio device. Don't complain if not there. */ fd_audio = audio_init(DEVICE_AUDIO, AUDIO_BUFSIZ, unit); + + /* + ** refclock_irig.c and refclock_wwv.c call audio_init() too, + ** but they tolerate fd == 0. + ** + ** This code will leak a file descriptor if it is 0. + ** + ** For now... + */ + INSIST(0 != fd_audio); /* Coverity 709185 */ + #ifdef DEBUG if (fd_audio > 0 && debug) audio_show();