about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--resolv/res_init.c5
2 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index d54e13d05c..298f0fdcbd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2017-09-06  Florian Weimer  <fweimer@redhat.com>
 
+	[BZ #22095]
+	* resolv/res_init.c (res_vinit_1): Avoid memory leak in case of
+	dynarray allocation failure.
+
+2017-09-06  Florian Weimer  <fweimer@redhat.com>
+
 	Remove dead PTR IPv4-to-IPv6 mapping code from nss_dns.
 	* resolv/nss_dns/dns-host.c (getanswer_r): Remove dead code.
 	* resolv/tst-res_use_inet6.c (response_ptr_v4, response_ptr_v6):
diff --git a/resolv/res_init.c b/resolv/res_init.c
index fa46ce7813..4e1f9fe8de 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;
             }