This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] fix a case of realloc not copying entire block (RH bug457508)
- From: Wolfram Gloger <wmglo at dent dot med dot uni-muenchen dot de>
- To: dvlasenk at redhat dot com
- Cc: libc-alpha at sources dot redhat dot com
- Date: 20 Aug 2008 15:20:40 -0000
- Subject: Re: [PATCH] fix a case of realloc not copying entire block (RH bug457508)
- References: <1219136314.3333.5.camel@localhost.localdomain>
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.