public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Florian Weimer <fw@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] resolv: free only initialized items from gai pool
Date: Mon, 20 Nov 2023 14:03:42 +0000 (GMT)	[thread overview]
Message-ID: <20231120140342.4930F3858C2D@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f2aaf18af50109b0982723bdf4e0a3bca2f8d3d6

commit f2aaf18af50109b0982723bdf4e0a3bca2f8d3d6
Author: Jan Palus <jpalus@fastmail.com>
Date:   Mon Oct 30 19:57:01 2023 +0100

    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 <jpalus@fastmail.com>
    Reviewed-by: Florian Weimer <fweimer@redhat.com>

Diff:
---
 resolv/gai_misc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/resolv/gai_misc.c b/resolv/gai_misc.c
index d02bd7ed23..266ed6931c 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);

                 reply	other threads:[~2023-11-20 14:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231120140342.4930F3858C2D@sourceware.org \
    --to=fw@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).