[vlc-devel] commit: potential NULL deref (CID 150) (Derk-Jan Hartman )

git version control git at videolan.org
Fri Oct 10 01:45:21 CEST 2008


vlc | branch: 0.9-bugfix | Derk-Jan Hartman <hartman at videolan.org> | Thu Oct  9 18:33:52 2008 +0200| [91af16091077a44429eea1ae1e6fc72b75e00220] | committer: Derk-Jan Hartman 

potential NULL deref (CID 150)
(cherry picked from commit 8a9bd2d83398fcabb0acdaf0b6a1362c47314594)

Signed-off-by: Derk-Jan Hartman <hartman at videolan.org>

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

 src/input/stream.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index 1e442b4..bb8e632 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -286,7 +286,15 @@ stream_t *stream_AccessNew( access_t *p_access, bool b_quick )
     stream_sys_t *p_sys;
     char *psz_list = NULL;
 
-    if( !s ) return NULL;
+    if( !s )
+        return NULL;
+
+    s->p_sys = p_sys = malloc( sizeof( stream_sys_t ) );
+    if( !p_sys )
+    {
+        vlc_object_release( s );
+        return NULL;
+    }
 
     /* Attach it now, needed for b_die */
     vlc_object_attach( s, p_access );
@@ -296,10 +304,6 @@ stream_t *stream_AccessNew( access_t *p_access, bool b_quick )
     s->pf_control = AStreamControl;
     s->pf_destroy = AStreamDestroy;
 
-    s->p_sys = p_sys = malloc( sizeof( stream_sys_t ) );
-    if( p_sys == NULL )
-        goto error;
-
     /* UTF16 and UTF32 text file conversion */
     s->i_char_width = 1;
     s->b_little_endian = false;




More information about the vlc-devel mailing list