public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] aio: Fix freeing memory
@ 2023-04-11 22:15 Samuel Thibault
  2023-04-12 12:39 ` Adhemerval Zanella Netto
  0 siblings, 1 reply; 3+ messages in thread
From: Samuel Thibault @ 2023-04-11 22:15 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault, commit-hurd

The content of the pool array is initialized only until pool_size,
pointers between pool_size and pool_max_size were not initialized by the
realloc call in get_elem so they should not be freed.

This fixes aio tests crashing at their termination on GNU/Hurd.
---
 rt/aio_misc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rt/aio_misc.c b/rt/aio_misc.c
index 49ec0aa293..4b850b1ab6 100644
--- a/rt/aio_misc.c
+++ b/rt/aio_misc.c
@@ -702,7 +702,7 @@ __aio_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.39.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] aio: Fix freeing memory
  2023-04-11 22:15 [PATCH] aio: Fix freeing memory Samuel Thibault
@ 2023-04-12 12:39 ` Adhemerval Zanella Netto
  2023-04-12 18:06   ` Samuel Thibault
  0 siblings, 1 reply; 3+ messages in thread
From: Adhemerval Zanella Netto @ 2023-04-12 12:39 UTC (permalink / raw)
  To: Samuel Thibault, libc-alpha; +Cc: commit-hurd



On 11/04/23 19:15, Samuel Thibault wrote:
> The content of the pool array is initialized only until pool_size,
> pointers between pool_size and pool_max_size were not initialized by the
> realloc call in get_elem so they should not be freed.
> 
> This fixes aio tests crashing at their termination on GNU/Hurd.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  rt/aio_misc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rt/aio_misc.c b/rt/aio_misc.c
> index 49ec0aa293..4b850b1ab6 100644
> --- a/rt/aio_misc.c
> +++ b/rt/aio_misc.c
> @@ -702,7 +702,7 @@ __aio_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);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] aio: Fix freeing memory
  2023-04-12 12:39 ` Adhemerval Zanella Netto
@ 2023-04-12 18:06   ` Samuel Thibault
  0 siblings, 0 replies; 3+ messages in thread
From: Samuel Thibault @ 2023-04-12 18:06 UTC (permalink / raw)
  To: Adhemerval Zanella Netto; +Cc: libc-alpha, commit-hurd

Adhemerval Zanella Netto, le mer. 12 avril 2023 09:39:00 -0300, a ecrit:
> On 11/04/23 19:15, Samuel Thibault wrote:
> > The content of the pool array is initialized only until pool_size,
> > pointers between pool_size and pool_max_size were not initialized by the
> > realloc call in get_elem so they should not be freed.
> > 
> > This fixes aio tests crashing at their termination on GNU/Hurd.
> 
> LGTM, thanks.
> 
> Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

Pushed, thanks!

Ah, only then I realize that I should have added your review tag, sorry!

Samuel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-12 18:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-11 22:15 [PATCH] aio: Fix freeing memory Samuel Thibault
2023-04-12 12:39 ` Adhemerval Zanella Netto
2023-04-12 18:06   ` Samuel Thibault

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).