[Git][NTPsec/ntpsec][master] 3 commits: refclock_oncore: add missing free() found by coverity.

Gary E. Miller gitlab at mg.gitlab.com
Thu May 25 23:28:18 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
9ed916ff by Gary E. Miller at 2017-05-25T16:18:43-07:00
refclock_oncore: add missing free() found by coverity.

- - - - -
732096e3 by Gary E. Miller at 2017-05-25T16:23:16-07:00
tests/binio: fix name clash of 'exp' on NetBSD.

- - - - -
8eca35f6 by Gary E. Miller at 2017-05-25T16:27:22-07:00
ntp_loopfilter: guard two static variables with #ifdef's.

This prevents unused variable warnings in some configurations.

- - - - -


3 changed files:

- ntpd/ntp_loopfilter.c
- ntpd/refclock_oncore.c
- tests/libparse/binio.c


Changes:

=====================================
ntpd/ntp_loopfilter.c
=====================================
--- a/ntpd/ntp_loopfilter.c
+++ b/ntpd/ntp_loopfilter.c
@@ -157,7 +157,9 @@ bool	ntp_enable = true;	/* clock discipline enabled */
 bool	pll_control = false;	/* kernel support available */
 bool	kern_enable = true;	/* kernel support enabled */
 bool	hardpps_enable;		/* kernel PPS discipline enabled */
+#ifdef HAVE_KERNEL_PLL
 static bool	ext_enable;	/* external clock enabled */
+#endif /* HAVE_KERNEL_PLL */
 bool	allow_panic = false;	/* allow panic correction (-g) */
 bool	force_step_once = false; /* always step time once at startup (-G) */
 bool	mode_ntpdate = false;	/* exit on first clock set (-q) */
@@ -167,7 +169,9 @@ static int freq_set;		/* initial set frequency switch */
 /*
  * Clock state machine variables
  */
+#ifndef ENABLE_LOCKCLOCK
 static int	state = 0;	/* clock discipline state */
+#endif /* ENABLE_LOCKCLOCK */
 uint8_t	sys_poll;		/* time constant/poll (log2 s) */
 int	tc_counter;		/* jiggle counter */
 double	last_offset;		/* last offset (s) */


=====================================
ntpd/refclock_oncore.c
=====================================
--- a/ntpd/refclock_oncore.c
+++ b/ntpd/refclock_oncore.c
@@ -658,6 +658,7 @@ oncore_start(
 	if (stat(device1, &stat1)) {
 		oncore_log_f(instance, LOG_ERR, "Can't stat fd1 (%s)",
 			     device1);
+		free(instance);
 		return false;		/* exit, no file, can't start driver */
 	}
 


=====================================
tests/libparse/binio.c
=====================================
--- a/tests/libparse/binio.c
+++ b/tests/libparse/binio.c
@@ -127,52 +127,52 @@ TEST(binio, get_lsb_int324) {
 
 TEST(binio, put_lsb_uint160) {
         unsigned char ret[2] = { 0, 0};
-        unsigned char exp[2] = { 0, 0};
+        unsigned char expect[2] = { 0, 0};
         unsigned char *bp = &ret[0];
 
         put_lsb_uint16( &bp, 0);
 
-        TEST_ASSERT_EQUAL_HEX8_ARRAY( exp, ret, 2 );
+        TEST_ASSERT_EQUAL_HEX8_ARRAY( expect, ret, 2 );
 }
 
 TEST(binio, put_lsb_uint161) {
         unsigned char ret[2] = { 0, 0};
-        unsigned char exp[2] = { 1, 0};
+        unsigned char expect[2] = { 1, 0};
         unsigned char *bp = &ret[0];
 
         put_lsb_uint16( &bp, 1);
 
-        TEST_ASSERT_EQUAL_HEX8_ARRAY( exp, ret, 2 );
+        TEST_ASSERT_EQUAL_HEX8_ARRAY( expect, ret, 2 );
 }
 
 TEST(binio, put_lsb_uint162) {
         unsigned char ret[2] = { 0, 0};
-        unsigned char exp[2] = { 0, 1};
+        unsigned char expect[2] = { 0, 1};
         unsigned char *bp = &ret[0];
 
         put_lsb_uint16( &bp, 256);
 
-        TEST_ASSERT_EQUAL_HEX8_ARRAY( exp, ret, 2 );
+        TEST_ASSERT_EQUAL_HEX8_ARRAY( expect, ret, 2 );
 }
 
 TEST(binio, put_lsb_uint163) {
         unsigned char ret[2] = { 0, 0};
-        unsigned char exp[2] = { 0xff, 0xff };
+        unsigned char expect[2] = { 0xff, 0xff };
         unsigned char *bp = &ret[0];
 
         put_lsb_uint16( &bp, 0xffff);
 
-        TEST_ASSERT_EQUAL_HEX8_ARRAY( exp, ret, 2 );
+        TEST_ASSERT_EQUAL_HEX8_ARRAY( expect, ret, 2 );
 }
 
 TEST(binio, put_lsb_uint164) {
         unsigned char ret[2] = { 0, 0};
-        unsigned char exp[2] = { 1, 0x80};
+        unsigned char expect[2] = { 1, 0x80};
         unsigned char *bp = &ret[0];
 
         put_lsb_uint16( &bp, 0x8001);
 
-        TEST_ASSERT_EQUAL_HEX8_ARRAY( exp, ret, 2 );
+        TEST_ASSERT_EQUAL_HEX8_ARRAY( expect, ret, 2 );
 }
 
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/64e8d23a3c746f01df516f003ed99d7084e430f1...8eca35f62bce574b199f8e26ec6e0215394bbb16

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/64e8d23a3c746f01df516f003ed99d7084e430f1...8eca35f62bce574b199f8e26ec6e0215394bbb16
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170525/6a8d7257/attachment.html>


More information about the vc mailing list