[Ffmpeg-devel] [PATCH] leak in mpegts.c
Michael Niedermayer
michaelni
Thu Mar 9 14:23:19 CET 2006
Hi
On Wed, Mar 08, 2006 at 08:40:04PM -0500, Andy Brown wrote:
> I couldn't find where the services that are populated during
> mpegts_read_header() where ever cleaned. This results in a leak since services
> are dynamically allocated. I verified that ts->services were still allocated at
> the call to mgts_read_close() which frees the MpegTSContext. The attached patch
> adds a function to free any allocated services. I added a call to this function
> in the mgts_read_close() call.
>
> Andy
> diff -Naurp ffmpeg/libavformat/mpegts.c ffmpeg-new/libavformat/mpegts.c
> --- ffmpeg/libavformat/mpegts.c Wed Mar 8 17:05:14 2006
> +++ ffmpeg-new/libavformat/mpegts.c Wed Mar 8 19:10:18 2006
> @@ -1368,12 +1368,32 @@ static int mpegts_read_packet(AVFormatCo
> }
> }
>
> +static int close_services(MpegTSContext *ts)
> +{
> + int i;
> + if (ts->nb_services)
> + {
> + for(i=ts->nb_services; i >= 0; --i)
wouldnt a normal for(i=0; i<ts->nb_services; i++) work too?
> + {
> + av_free(ts->services[i]->provider_name);
> + av_free(ts->services[i]->name);
> + av_free(ts->services[i]);
> + ts->services[i] = NULL;
see av_freep()
except these ill leave the reviewing/apply/reject to our mpeg-ts maintainer
[...]
--
Michael
More information about the ffmpeg-devel
mailing list