]> git.sesse.net Git - vlc/commitdiff
Memory leak (fix #2448)
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Mon, 26 Jan 2009 19:55:36 +0000 (21:55 +0200)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Mon, 26 Jan 2009 19:56:36 +0000 (21:56 +0200)
N.B.: I hate branching macros for a reason

src/control/mediacontrol_core.c

index 67a4cbef8168099596e5100b0ca1c0dffbf5fa0a..240c93fb7dc9b1498cdfd78dac1557cb5d14a508 100644 (file)
@@ -346,7 +346,15 @@ mediacontrol_get_stream_information( mediacontrol_Instance *self,
     }
 
     p_media = libvlc_media_player_get_media( self->p_media_player, &ex );
-    HANDLE_LIBVLC_EXCEPTION_NULL( &ex );
+    if( libvlc_exception_raised( &ex ) )
+    {
+        free( retval );
+        RAISE( mediacontrol_InternalException,
+               libvlc_exception_get_message( &ex ) );
+        libvlc_exception_clear( &ex );
+        return NULL;
+    }
+
     if( ! p_media )
     {
         /* No p_media defined */
@@ -358,8 +366,17 @@ mediacontrol_get_stream_information( mediacontrol_Instance *self,
     else
     {
         libvlc_state_t state;
+
         state = libvlc_media_player_get_state( self->p_media_player, &ex );
-        HANDLE_LIBVLC_EXCEPTION_NULL( &ex );
+        if( libvlc_exception_raised( &ex ) )
+        {
+            free( retval );
+            RAISE( mediacontrol_InternalException,
+                   libvlc_exception_get_message( &ex ) );
+            libvlc_exception_clear( &ex );
+            return NULL;
+        }
+
         switch( state )
         {
         case libvlc_NothingSpecial: