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

git version control git at videolan.org
Thu Oct 9 18:34:31 CEST 2008


vlc | branch: master | Derk-Jan Hartman <hartman at videolan.org> | Thu Oct  9 18:33:52 2008 +0200| [8a9bd2d83398fcabb0acdaf0b6a1362c47314594] | committer: Derk-Jan Hartman 

potential NULL deref (CID 150)

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

 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 9584713..62af247 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -301,7 +301,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 );
@@ -311,10 +319,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