diff --git a/src/tracker-extract/tracker-extract-libav.c b/src/tracker-extract/tracker-extract-libav.c
index ab86e87..8c21e32 100644
--- a/src/tracker-extract/tracker-extract-libav.c
+++ b/src/tracker-extract/tracker-extract-libav.c
@@ -185,7 +185,7 @@
 	}
 
 	if (!audio_stream && !video_stream) {
-		avformat_free_context (format);
+		avformat_close_input (&format);
 		g_free (uri);
 		return FALSE;
 	}
@@ -403,7 +403,7 @@
 
 	g_free (uri);
 
-	avformat_free_context (format);
+	avformat_close_input (&format);
 
 	return TRUE;
 }

