This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] fix a case of realloc not copying entire block (RH bug457508)


Hi,

> Even though I failed to reproduce it, the patch looks obviously correct.
...
> --- libc/malloc/malloc.c	2008-03-04 19:36:04.000000000 +0100
> +++ libc/malloc/malloc.c	2008-08-14 18:43:22.000000000 +0200
> @@ -3717,7 +3717,7 @@ public_rEALLOc(Void_t* oldmem, size_t by
>        newp = public_mALLOc(bytes);
>        if (newp != NULL)
>  	{
> -	  MALLOC_COPY (newp, oldmem, oldsize - 2 * SIZE_SZ);
> +	  MALLOC_COPY (newp, oldmem, oldsize - SIZE_SZ);
>  #if THREAD_STATS
>  	  if(!mutex_trylock(&ar_ptr->mutex))
>  	    ++(ar_ptr->stat_lock_direct);
> 

Yes, patch looks obviously correct to me, too.

I never merged the 1.166 change into ptmalloc2 (sorry), so I failed to
notice.

And, in case anyone wonders, the _identical_ MALLOC_COPY statement 35
source lines above (where the above was probably cut&pasted from) _is_
in fact correct, because the overhead for mmapped chunks is 2*SIZE_SZ.

Regards,
Wolfram.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]