[vlc-commits] Fix memory leaks and correct one delete/delete[] missmach

Daniel Winzen git at videolan.org
Fri May 1 19:25:26 CEST 2015


vlc | branch: master | Daniel Winzen <d at winzen4.de> | Thu Apr 30 18:30:14 2015 +0000| [063cba9f0289af6c1ff3fb419366a5ece386d9f0] | committer: Jean-Baptiste Kempf

Fix memory leaks and correct one delete/delete[] missmach

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=063cba9f0289af6c1ff3fb419366a5ece386d9f0
---

 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 ac409d2..fa79924 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



More information about the vlc-commits mailing list