public inbox for libc-stable@sourceware.org
 help / color / mirror / Atom feed
* [2.26 COMMITTED] resolv: Fix memory leak with OOM during resolv.conf parsing [BZ #22095]
@ 2017-01-01  0:00 Florian Weimer
  0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2017-01-01  0:00 UTC (permalink / raw)
  To: libc-stable

(cherry picked from commit 5670c4ab256114e869b1df4b05653aa5f909182c)

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.

diff --git a/NEWS b/NEWS
index 8fbf4241d1..62959274b3 100644
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,7 @@ The following bugs are resolved with this release:
   [21932] Unpaired __resolv_context_get in generic get*_r implementation
   [21941] powerpc: Restrict xssqrtqp operands to Vector Registers
   [21972] assert macro requires operator== (int) for its argument type
+  [22095] resolv: Fix memory leak with OOM during resolv.conf parsing
 \f
 Version 2.26
 
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;
             }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-09-06 14:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-01  0:00 [2.26 COMMITTED] resolv: Fix memory leak with OOM during resolv.conf parsing [BZ #22095] Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).