1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
| | This patch fixes some problems in the glibc 2.26 resolver.
https://sourceware.org/bugzilla/show_bug.cgi?id=22095
https://sourceware.org/bugzilla/show_bug.cgi?id=22096
Picked from these commits:
https://sourceware.org/git/?p=glibc.git;a=commit;h=905a6129147e7ee80e8918e23efe212433b8cce7
https://sourceware.org/git/?p=glibc.git;a=commit;h=27233446a62ca35ce0b54566279a99a6774d4210
From 905a6129147e7ee80e8918e23efe212433b8cce7 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Wed, 6 Sep 2017 15:46:54 +0200
Subject: [PATCH] resolv: Fix memory leak with OOM during resolv.conf parsing
[BZ #22095]
diff --git a/resolv/res_init.c b/resolv/res_init.c
index fa46ce7..4e1f9fe 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -446,6 +446,11 @@ res_vinit_1 (FILE *fp, struct resolv_conf_parser *parser)
(&parser->nameserver_list);
if (p != NULL)
*p = sa;
+ else
+ {
+ free (sa);
+ return false;
+ }
}
continue;
}
From 27233446a62ca35ce0b54566279a99a6774d4210 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Wed, 6 Sep 2017 15:47:27 +0200
Subject: [PATCH] resolv: __resolv_conf_attach must not free passed conf object
[BZ #22096]
diff --git a/resolv/resolv_conf.c b/resolv/resolv_conf.c
index f391d30c2..e0f296d 100644
--- a/resolv/resolv_conf.c
+++ b/resolv/resolv_conf.c
@@ -600,10 +600,7 @@ __resolv_conf_attach (struct __res_state *resp, struct resolv_conf *conf)
struct resolv_conf_global *global_copy = get_locked_global ();
if (global_copy == NULL)
- {
- free (conf);
- return false;
- }
+ return false;
/* Try to find an unused index in the array. */
size_t index;
|