This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH COMMITTED] resolv: Fix memory leak with OOM during resolv.conf parsing [BZ #22095]
- From: fweimer at redhat dot com (Florian Weimer)
- To: libc-alpha at sourceware dot org
- Date: Wed, 06 Sep 2017 15:23:07 +0200
- Subject: [PATCH COMMITTED] resolv: Fix memory leak with OOM during resolv.conf parsing [BZ #22095]
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=fweimer at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A040E806A7
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/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;
}