]> git.sesse.net Git - vlc/commitdiff
potential NULL deref (CID 150)
authorDerk-Jan Hartman <hartman@videolan.org>
Thu, 9 Oct 2008 16:33:52 +0000 (18:33 +0200)
committerDerk-Jan Hartman <hartman@videolan.org>
Thu, 9 Oct 2008 16:33:52 +0000 (18:33 +0200)
src/input/stream.c

index 9584713834c779f262a59a6d22e242706a402887..62af24789a9c39e7eac9f2fb01879d5679685d9c 100644 (file)
@@ -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;