]> git.ipfire.org Git - thirdparty/nqptp.git/commitdiff
fix a few [unimportant] valgrind warnings.
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Wed, 24 Mar 2021 07:59:18 +0000 (07:59 +0000)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Wed, 24 Mar 2021 07:59:18 +0000 (07:59 +0000)
nqptp.c

diff --git a/nqptp.c b/nqptp.c
index f5240e1f3e3b2ca43a1363414eecb8e40e0f2fcc..f414407759c0ebb0a6e1a014f96b71b4673e90ba 100644 (file)
--- a/nqptp.c
+++ b/nqptp.c
@@ -424,11 +424,13 @@ int main(void) {
 
   // control-c (SIGINT) cleanly
   struct sigaction act;
+  memset(&act,0,sizeof(struct sigaction));
   act.sa_handler = intHandler;
   sigaction(SIGINT, &act, NULL);
 
   // terminate (SIGTERM)
   struct sigaction act2;
+  memset(&act2,0,sizeof(struct sigaction));
   act2.sa_handler = termHandler;
   sigaction(SIGTERM, &act2, NULL);
 
@@ -495,7 +497,6 @@ int main(void) {
     struct ptp_delay_resp delay_resp;
   };
 
-  int next_free_clock_source_entry = 0;
   pthread_mutexattr_t shared;
   int err;
 
@@ -689,7 +690,11 @@ int main(void) {
   if (shared_memory == (struct shm_structure *)-1) {
     die("failed to mmap shared memory \"%s\".", STORAGE_ID);
   }
-
+  
+  if ((close(shm_fd) == -1)) {
+    warn("error closing \"/nqptp\" after mapping.");
+  }
+  
   // zero it
   memset(shared_memory, 0, sizeof(struct shm_structure));
   shared_memory->size_of_clock_array = MAX_SHARED_CLOCKS;