From e4f8c1f447c40905fa3bdf562dc10dcdf3422ed9 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 14 Jul 2015 18:27:49 +0200 Subject: clean AVFormatContext --- mpd-notification.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mpd-notification.c b/mpd-notification.c index 0bfa252..bf4ebc9 100644 --- a/mpd-notification.c +++ b/mpd-notification.c @@ -61,7 +61,7 @@ void received_signal(int signal) { GdkPixbuf * retrieve_album_art(const char * music_dir, const char * uri) { int i; AVPacket pkt; - AVFormatContext * pFormatCtx = NULL; + AVFormatContext * pFormatCtx; GdkPixbufLoader * loader; GdkPixbuf * pixbuf = NULL; char * uri_path = NULL; @@ -101,12 +101,12 @@ GdkPixbuf * retrieve_album_art(const char * music_dir, const char * uri) { } fail: + avformat_close_input(&pFormatCtx); + avformat_free_context(pFormatCtx); + if (uri_path) free(uri_path); - if (pFormatCtx) - avformat_free_context(pFormatCtx); - return pixbuf; } #endif -- cgit v1.2.3-70-g09d2