[FFmpeg-devel] [PATCH] qt-faststart: Clean up properly at all exit points

Reimar Döffinger Reimar.Doeffinger
Sun May 2 01:16:58 CEST 2010


On Sun, May 02, 2010 at 12:18:31AM +0300, Martin Storsj? wrote:
> On Sat, 1 May 2010, Martin Storsj? wrote:
> > On Fri, 30 Apr 2010, Baptiste Coudurier wrote:
> > 
> > > On 04/30/2010 03:37 AM, Martin Storsj? wrote:
> > > > Hi,
> > > > 
> > > > qt-faststart currently cleans up almost everything at all exit points, but
> > > > misses freeing the ftyp_atom buffer.
> > > > 
> > > 
> > > Ok, maybe goto common cleanup code would be better in the future.
> > 
> > Yeah, that would perhaps be a cleaner solution, I'll give it a try 
> > shortly.
> 
> What about this? This makes the file 18 lines shorter.

Ups, replied to the commit too fast.

> -    FILE *infile;
> -    FILE *outfile;
> +    FILE *infile = 0;
> +    FILE *outfile = 0;
> -    unsigned char *moov_atom;
> +    unsigned char *moov_atom = 0;

Please use NULL for pointers.

> @@ -100,8 +100,7 @@ int main(int argc, char *argv[])
>  
>      infile = fopen(argv[1], "rb");
>      if (!infile) {
> -        perror(argv[1]);
> -        return 1;
> +        goto error_out;

You removed the perror...



More information about the ffmpeg-devel mailing list