File resolv-conf-oom.patch of Package glibc.14271

2017-09-06  Florian Weimer  <fweimer@redhat.com>

	[BZ #22096]
	* resolv/resolv_conf.c (__resolv_conf_attach): Do not free conf in
	case of failure to obtain the global conf object.

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.

Index: glibc-2.26/resolv/res_init.c
===================================================================
--- glibc-2.26.orig/resolv/res_init.c
+++ glibc-2.26/resolv/res_init.c
@@ -446,6 +446,11 @@ res_vinit_1 (FILE *fp, struct resolv_con
                     (&parser->nameserver_list);
                   if (p != NULL)
                     *p = sa;
+                  else
+                    {
+                      free (sa);
+                      return false;
+                    }
                 }
               continue;
             }
Index: glibc-2.26/resolv/resolv_conf.c
===================================================================
--- glibc-2.26.orig/resolv/resolv_conf.c
+++ glibc-2.26/resolv/resolv_conf.c
@@ -600,10 +600,7 @@ __resolv_conf_attach (struct __res_state
 
   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;
openSUSE Build Service is sponsored by