libvlc: fix libvlc_media_player_get_fps leak
authorThomas Guillem <thomas@gllm.fr>
Tue, 31 May 2016 10:02:16 +0000 (12:02 +0200)
committerThomas Guillem <thomas@gllm.fr>
Tue, 31 May 2016 14:23:09 +0000 (16:23 +0200)
And fix a possible use of a released media.

lib/media_player.c

index a2be453..e56f63f 100644 (file)
@@ -1653,7 +1653,7 @@ float libvlc_media_player_get_fps( libvlc_media_player_t *p_mi )
     if( media == NULL )
         return 0.f;
 
-    input_item_t *item = p_mi->p_md->p_input_item;
+    input_item_t *item = media->p_input_item;
     float fps = 0.f;
 
     vlc_mutex_lock( &item->lock );
@@ -1666,6 +1666,7 @@ float libvlc_media_player_get_fps( libvlc_media_player_t *p_mi )
                   / (float)fmt->video.i_frame_rate_base;
     }
     vlc_mutex_unlock( &item->lock );
+    libvlc_media_release( media );
 
     return fps;
 }