]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/dnsmasq/0051-Fix-trivial-memory-leaks-to-quieten-valgrind.patch
Merge branch 'next' of ssh://git.ipfire.org/pub/git/ipfire-2.x into next
[ipfire-2.x.git] / src / patches / dnsmasq / 0051-Fix-trivial-memory-leaks-to-quieten-valgrind.patch
1 From 28b879ac47b872af6e8c5e86d76806c69338434d Mon Sep 17 00:00:00 2001
2 From: Chen Wei <weichen302@icloud.com>
3 Date: Tue, 17 Feb 2015 22:07:35 +0000
4 Subject: [PATCH 51/78] Fix trivial memory leaks to quieten valgrind.
5
6 ---
7 src/dnsmasq.c | 2 ++
8 src/option.c | 11 +++++++++--
9 2 files changed, 11 insertions(+), 2 deletions(-)
10
11 diff --git a/src/dnsmasq.c b/src/dnsmasq.c
12 index e903a24c8105..e6dabbf556f7 100644
13 --- a/src/dnsmasq.c
14 +++ b/src/dnsmasq.c
15 @@ -627,6 +627,8 @@ int main (int argc, char **argv)
16 }
17
18 #ifdef HAVE_LINUX_NETWORK
19 + free(hdr);
20 + free(data);
21 if (option_bool(OPT_DEBUG))
22 prctl(PR_SET_DUMPABLE, 1, 0, 0, 0);
23 #endif
24 diff --git a/src/option.c b/src/option.c
25 index e4b4865d07a5..ae0ad002d8b8 100644
26 --- a/src/option.c
27 +++ b/src/option.c
28 @@ -4361,7 +4361,7 @@ void read_opts(int argc, char **argv, char *compile_opts)
29 {
30 char *buff = opt_malloc(MAXDNAME);
31 int option, conffile_opt = '7', testmode = 0;
32 - char *arg, *conffile = CONFFILE;
33 + char *arg, *conffile = NULL;
34
35 opterr = 0;
36
37 @@ -4476,7 +4476,14 @@ void read_opts(int argc, char **argv, char *compile_opts)
38 }
39
40 if (conffile)
41 - one_file(conffile, conffile_opt);
42 + {
43 + one_file(conffile, conffile_opt);
44 + free(conffile);
45 + }
46 + else
47 + {
48 + one_file(CONFFILE, conffile_opt);
49 + }
50
51 /* port might not be known when the address is parsed - fill in here */
52 if (daemon->servers)
53 --
54 2.1.0
55