mmstu: handle keepalive error case
authorJean-Paul Saman <jean-paul.saman@m2x.nl>
Tue, 12 May 2009 12:11:30 +0000 (14:11 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 14 May 2009 16:58:40 +0000 (18:58 +0200)
(cherry picked from commit e692b86ada5f970fb37b1db137a9d68148dc6ec2)

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/access/mms/mmstu.c

index 1ae4b90..f0d600f 100644 (file)
@@ -201,6 +201,11 @@ int  MMSTUOpen( access_t *p_access )
 
     /* Keep the connection alive when paused */
     p_sys->p_keepalive = malloc( sizeof( mmstu_keepalive_t ) );
+    if( !p_sys->p_keepalive )
+    {
+        MMSTUClose ( p_access );
+        return VLC_ENOMEM;
+    }
     p_sys->p_keepalive->p_access = p_access;
     vlc_mutex_init( &p_sys->p_keepalive->lock );
     vlc_cond_init( &p_sys->p_keepalive->wait );
@@ -305,11 +310,14 @@ static int Control( access_t *p_access, int i_query, va_list args )
             else
                 Seek( p_access, p_access->info.i_pos );
 
-            vlc_mutex_lock( &p_sys->p_keepalive->lock );
-            p_sys->p_keepalive->b_paused = b_bool;
-            if( b_bool )
-                vlc_cond_signal( &p_sys->p_keepalive->wait );
-            vlc_mutex_unlock( &p_sys->p_keepalive->lock );
+            if( p_sys->p_keepalive )
+            {
+                vlc_mutex_lock( &p_sys->p_keepalive->lock );
+                p_sys->p_keepalive->b_paused = b_bool;
+                if( b_bool )
+                    vlc_cond_signal( &p_sys->p_keepalive->wait );
+                vlc_mutex_unlock( &p_sys->p_keepalive->lock );
+            }
             break;
 
         case ACCESS_GET_TITLE_INFO: