[FFmpeg-devel] [PATCH] id3v2 unsynchronisation support
Michael Niedermayer
michaelni
Tue Aug 10 15:26:59 CEST 2010
On Mon, Aug 09, 2010 at 10:03:09PM +1000, Alexander Kojevnikov wrote:
> 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
exactly
[...]
> @@ -212,8 +216,26 @@ void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags)
>
> 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) {
> + buffer = av_realloc(buffer, tlen);
> + buffer_size = tlen;
> + }
why the if() ?
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100810/8f204965/attachment.pgp>
More information about the ffmpeg-devel
mailing list