* [PATCH] resolv: free only initialized items from gai pool
@ 2023-10-30 18:57 Jan Palus
2023-11-20 14:04 ` Florian Weimer
0 siblings, 1 reply; 2+ messages in thread
From: Jan Palus @ 2023-10-30 18:57 UTC (permalink / raw)
To: libc-alpha; +Cc: Jan Palus
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>
---
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);
--
2.42.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] resolv: free only initialized items from gai pool
2023-10-30 18:57 [PATCH] resolv: free only initialized items from gai pool Jan Palus
@ 2023-11-20 14:04 ` Florian Weimer
0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer @ 2023-11-20 14:04 UTC (permalink / raw)
To: Jan Palus; +Cc: libc-alpha
* Jan Palus:
> 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>
> ---
> 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);
Thanks.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
And pushed.
Florian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-20 14:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-30 18:57 [PATCH] resolv: free only initialized items from gai pool Jan Palus
2023-11-20 14:04 ` 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).