[FFmpeg-devel] [PATCH] fix small memleak in rdt.c

Ronald S. Bultje rsbultje
Fri Nov 14 23:56:02 CET 2008


Hi,

On Fri, Nov 14, 2008 at 4:48 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
[..]

I'll leave the discussion on removing / renaming etc. in the other
thread, makes it simpler to keep track...

> On Fri, Nov 14, 2008 at 03:17:26PM -0500, Ronald S. Bultje wrote:
>> -    url_close_buf(pb);
>> +    url_close_buf(&pb);
>
> this isnt intended to stay or?

I guess it can go, it doesn't do anything. Removed in this version. I
used av_alloc_put_byte() as suggested for the remaining occurrence.

>> @@ -250,32 +251,33 @@
>>                    const uint8_t *buf, int len, int flags)
>>  {
>>      int seq = 1, res;
>> -    ByteIOContext *pb = rdt->rmctx->pb;
>> +    ByteIOContext pb;
> [...]
>> +        rdt->rmctx->pb = &pb;
>
> you know that pb is on the stack and this stores it in a context that i
> do not know if it might live longer than the local variables ...

Yes, I added = NULL statements to make it clearer, but they're only
used within the local context, never after the function has returned.

New patch attached.

Ronald
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fix-memleak.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081114/7da4ec2f/attachment.asc>



More information about the ffmpeg-devel mailing list