[vlc-devel] [PATCH] Fix memory leaks and correct one delete/delete[] missmach
Jean-Baptiste Kempf
jb at videolan.org
Sat May 2 21:01:54 CEST 2015
Applied, thanks.
On 30 Apr, Daniel Winzen wrote :
> ---
> doc/libvlc/libvlc_DVD_ripper.c | 5 ++++-
> modules/access/dtv/bdagraph.cpp | 2 +-
> modules/access/zip/zipstream.c | 5 ++++-
> modules/codec/quicktime.c | 1 +
> modules/demux/mp4/mp4.c | 1 +
> 5 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/doc/libvlc/libvlc_DVD_ripper.c b/doc/libvlc/libvlc_DVD_ripper.c
> index 57fc896..7a6e778 100644
> --- a/doc/libvlc/libvlc_DVD_ripper.c
> +++ b/doc/libvlc/libvlc_DVD_ripper.c
> @@ -155,7 +155,10 @@ void on_run(GtkWidget *widget, gpointer data) {
> transcode = get_transcode_string(preset);
> free(preset);
> sout = malloc((strlen(transcode)+strlen(file_begin)+strlen(dest)+strlen(file_end)+1) * sizeof(char));
> - if(sout == NULL) return;
> + if(sout == NULL) {
> + free(handle);
> + return;
> + }
> strncpy(sout, transcode, strlen(transcode)+1);
> strncat(sout, file_begin, strlen(file_begin));
> strncat(sout, dest, strlen(dest));
> diff --git a/modules/access/dtv/bdagraph.cpp b/modules/access/dtv/bdagraph.cpp
> index 997c5b4..17cfd0c 100644
> --- a/modules/access/dtv/bdagraph.cpp
> +++ b/modules/access/dtv/bdagraph.cpp
> @@ -3370,7 +3370,7 @@ IPin* BDAGraph::FindPinOnFilter( IBaseFilter* pBaseFilter, const char* pPinName)
> else
> pPin = NULL; // no
>
> - delete pString;
> + delete[] pString;
>
> }
> else
> diff --git a/modules/access/zip/zipstream.c b/modules/access/zip/zipstream.c
> index a8c188b..b2199f9 100644
> --- a/modules/access/zip/zipstream.c
> +++ b/modules/access/zip/zipstream.c
> @@ -575,7 +575,10 @@ static int WriteXSPF( char **pp_buffer, vlc_array_t *p_filenames,
> /* Encode the URI and append ZIP_SEP */
> char *psz_pathtozip;
> escapeToXml( &psz_pathtozip, psz_zippath );
> - if( astrcatf( &psz_pathtozip, "%s", ZIP_SEP ) < 0 ) return -1;
> + if( astrcatf( &psz_pathtozip, "%s", ZIP_SEP ) < 0 ) {
> + free_all_node( playlist );
> + return -1;
> + }
>
> int i_track = 0;
> for( int i = 0; i < vlc_array_count( p_filenames ); ++i )
> diff --git a/modules/codec/quicktime.c b/modules/codec/quicktime.c
> index 885c758..a1715fb 100644
> --- a/modules/codec/quicktime.c
> +++ b/modules/codec/quicktime.c
> @@ -803,6 +803,7 @@ static int OpenVideo( decoder_t *p_dec )
>
> p_sys->framedescHandle = (ImageDescriptionHandle) NewHandleClear( id->idSize );
> memcpy( *p_sys->framedescHandle, id, id->idSize );
> + free( id );
>
> if( p_dec->fmt_in.video.i_width != 0 && p_dec->fmt_in.video.i_height != 0)
> p_sys->plane = malloc( p_dec->fmt_in.video.i_width * p_dec->fmt_in.video.i_height * 3 );
> diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
> index 4d3f517..e4da4aa 100644
> --- a/modules/demux/mp4/mp4.c
> +++ b/modules/demux/mp4/mp4.c
> @@ -4460,6 +4460,7 @@ static mp4_fragment_t * GetFragmentByTime( demux_t *p_demux, const mtime_t i_tim
> if ( i_time >= i_base_time &&
> i_time <= i_base_time + i_length )
> {
> + free( pi_tracks_duration_total );
> return p_fragment;
> }
> else
> --
> 2.1.4
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
--
With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the vlc-devel
mailing list