[vlc-devel] commit: Fix potential NULL dereference (CID 27). ( Rémi Duraffort )

git version control git at videolan.org
Wed Oct 22 20:30:00 CEST 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Wed Oct 22 20:29:14 2008 +0200| [02c79d62bc88443be0c1b70fc00be3517bc9b67d] | committer: Rémi Duraffort 

Fix potential NULL dereference (CID 27).
And fix a potential memleak.

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

 src/video_output/video_output.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 41e78da..36bc4f9 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1557,13 +1557,21 @@ static int DeinterlaceCallback( vlc_object_t *p_this, char const *psz_cmd,
     {
         psz_filter = realloc( psz_filter, strlen( psz_filter ) +
                               sizeof(":deinterlace") );
-        if( psz_filter && *psz_filter ) strcat( psz_filter, ":" );
-        strcat( psz_filter, "deinterlace" );
+        if( psz_filter )
+        {
+            if( *psz_filter )
+                strcat( psz_filter, ":" );
+            strcat( psz_filter, "deinterlace" );
+        }
     }
 
     p_input = (input_thread_t *)vlc_object_find( p_this, VLC_OBJECT_INPUT,
                                                  FIND_PARENT );
-    if( !p_input ) return VLC_EGENERIC;
+    if( !p_input )
+    {
+        free( psz_filter );
+        return VLC_EGENERIC;
+    }
 
     if( psz_mode && *psz_mode )
     {




More information about the vlc-devel mailing list