]> git.ipfire.org Git - people/ms/dnsmasq.git/commitdiff
Fix trivial memory leaks to quieten valgrind.
authorChen Wei <weichen302@icloud.com>
Tue, 17 Feb 2015 22:07:35 +0000 (22:07 +0000)
committerSimon Kelley <simon@thekelleys.org.uk>
Tue, 17 Feb 2015 22:07:35 +0000 (22:07 +0000)
src/dnsmasq.c
src/option.c

index e903a24c810543c2959fbec0bd930e1b63323b96..e6dabbf556f76e0c58f7e3d0ab875c3a82eab88e 100644 (file)
@@ -627,6 +627,8 @@ int main (int argc, char **argv)
     }
   
 #ifdef HAVE_LINUX_NETWORK
+  free(hdr);
+  free(data);
   if (option_bool(OPT_DEBUG)) 
     prctl(PR_SET_DUMPABLE, 1, 0, 0, 0);
 #endif
index e4b4865d07a5e0fec9776e2b9508482282fa7525..ae0ad002d8b828bcee37649ee4b3c59e226b85ed 100644 (file)
@@ -4361,7 +4361,7 @@ void read_opts(int argc, char **argv, char *compile_opts)
 {
   char *buff = opt_malloc(MAXDNAME);
   int option, conffile_opt = '7', testmode = 0;
-  char *arg, *conffile = CONFFILE;
+  char *arg, *conffile = NULL;
       
   opterr = 0;
 
@@ -4476,7 +4476,14 @@ void read_opts(int argc, char **argv, char *compile_opts)
     }
 
   if (conffile)
-    one_file(conffile, conffile_opt);
+    {
+      one_file(conffile, conffile_opt);
+      free(conffile);
+    }
+  else
+    {
+      one_file(CONFFILE, conffile_opt);
+    }
 
   /* port might not be known when the address is parsed - fill in here */
   if (daemon->servers)