This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] memory leak in libio/wfileops.c do_ftell_wide [BZ #17370]
- From: Allan McRae <allan at archlinux dot org>
- To: Siddhesh Poyarekar <siddhesh at redhat dot com>, Tim Lammens <tim dot lammens at gmail dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Sat, 13 Sep 2014 15:48:11 +1000
- Subject: Re: [PATCH] memory leak in libio/wfileops.c do_ftell_wide [BZ #17370]
- Authentication-results: sourceware.org; auth=none
- References: <CAC+sh-dSpNLcdwkJA_J+XPFCxmMibgcAbof71o2eQ2pK5O2b-A at mail dot gmail dot com> <20140910230520 dot GC29810 at spoyarek dot pnq dot redhat dot com>
On 11/09/14 09:05, Siddhesh Poyarekar wrote:
> On Wed, Sep 10, 2014 at 10:21:23PM +0200, Tim Lammens wrote:
>> Hi,
>>
>> Here is a patch to fix the memory leak in libio/wfileops.c.
>
> Thanks, I'll push this fix. Your submission is lacking a ChangeLog,
> but I'll write it up for you. If you're looking to contribute more
> regularly, you might want to review the contribution checklist[1].
>
> Siddhesh
>
> [1] https://sourceware.org/glibc/wiki/Contribution%20checklist
>
Do we also need to free this in the error case directly above?
>>
>>
>> diff --git a/libio/wfileops.c b/libio/wfileops.c
>> index f123add..4b8fda9 100644
>> --- a/libio/wfileops.c
>> +++ b/libio/wfileops.c
>> @@ -711,6 +711,7 @@ do_ftell_wide (_IO_FILE *fp)
>> return WEOF;
>>
>> offset += outstop - out;
>> + free(out);
>> }
>>
>> /* We don't trust _IO_read_end to represent the current file offset