diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c
index 93d54e01e8338d780f9651fc2ec8dc7e672b5bf7..d0c51ae1144dcbea34f0e32ada418e4db9f2d0be 100644
--- a/libavformat/mlvdec.c
+++ b/libavformat/mlvdec.c
@@ -445,7 +445,7 @@ static int read_close(AVFormatContext *s)
     int i;
     for (i = 0; i < 100; i++)
         if (mlv->pb[i])
-            avio_close(mlv->pb[i]);
+            avio_closep(&mlv->pb[i]);
     return 0;
 }