From: Jan Palus Date: Mon, 30 Oct 2023 18:57:01 +0000 (+0100) Subject: resolv: free only initialized items from gai pool X-Git-Tag: glibc-2.39~272 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2aaf18af50109b0982723bdf4e0a3bca2f8d3d6;p=thirdparty%2Fglibc.git resolv: free only initialized items from gai pool pool_max_size denotes total allocated rows in pool but possibly not yet initialized. it's pool_size that represents number of actually occupied rows hence use it when freeing pool to avoid freeing random addresses. Signed-off-by: Jan Palus Reviewed-by: Florian Weimer --- diff --git a/resolv/gai_misc.c b/resolv/gai_misc.c index d02bd7ed236..266ed6931cb 100644 --- a/resolv/gai_misc.c +++ b/resolv/gai_misc.c @@ -1,4 +1,5 @@ /* Copyright (C) 2001-2023 Free Software Foundation, Inc. + Copyright The GNU Toolchain Authors. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -442,7 +443,7 @@ __gai_freemem (void) { size_t row; - for (row = 0; row < pool_max_size; ++row) + for (row = 0; row < pool_size; ++row) free (pool[row]); free (pool);