[FFmpeg-devel] [PATCH] id3v2 unsynchronisation support

Alexander Kojevnikov alexander
Mon Aug 9 14:03:09 CEST 2010


On 9 August 2010 22:52, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Thu, Jul 29, 2010 at 10:22:16AM +1000, Alexander Kojevnikov wrote:
> [...]
>
>>
>> ? ? ? ? ?next = url_ftell(s->pb) + tlen;
>>
>> - ? ? ? ?if (tag[0] == 'T')
>> - ? ? ? ? ? ?read_ttag(s, tlen, tag);
>> + ? ? ? ?if (tag[0] == 'T') {
>> + ? ? ? ? ? ?if (unsync || tunsync) {
>> + ? ? ? ? ? ? ? ?int i, j;
>> + ? ? ? ? ? ? ? ?if (buffer_size < tlen) {
>> + ? ? ? ? ? ? ? ? ? ?av_free(buffer);
>> + ? ? ? ? ? ? ? ? ? ?buffer = av_malloc(tlen);
>> + ? ? ? ? ? ? ? ? ? ?buffer_size = tlen;
>> + ? ? ? ? ? ? ? ?}
>
> why not allways av_realloc() ?
> av_realloc(NULL) == av_malloc()

Fixed.

> [...]
>> @@ -230,6 +253,8 @@ void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags)
>> ? ? ?}
>> ? ? ?if (version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip over it */
>> ? ? ? ? ?url_fskip(s->pb, 10);
>> +
>> + ? ?av_free(buffer);
>> ? ? ?return;
>>
>> ? ?error:
>
> this looks like a recipe for a memleak

You mean it would memleak if in the future a `goto error` is added
somewhere inside the `while` loop? I added another `av_free()` call in
the `error:` block, let me know if I misunderstood your comment.

Thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-id3v2-unsynchronisation-support.patch
Type: text/x-patch
Size: 5241 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100809/0c25db28/attachment.bin>



More information about the ffmpeg-devel mailing list