diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c
index 60c1bd922280ba204828a5c6dd6004637316b0ad..548223116f759bbd744f7ace73472eef944a8c9d 100644
--- a/libavformat/jvdec.c
+++ b/libavformat/jvdec.c
@@ -59,6 +59,15 @@ static int read_probe(AVProbeData *pd)
     return 0;
 }
 
+static int read_close(AVFormatContext *s)
+{
+    JVDemuxContext *jv = s->priv_data;
+
+    av_freep(&jv->frames);
+
+    return 0;
+}
+
 static int read_header(AVFormatContext *s)
 {
     JVDemuxContext *jv = s->priv_data;
@@ -221,15 +230,6 @@ static int read_seek(AVFormatContext *s, int stream_index,
     return 0;
 }
 
-static int read_close(AVFormatContext *s)
-{
-    JVDemuxContext *jv = s->priv_data;
-
-    av_freep(&jv->frames);
-
-    return 0;
-}
-
 AVInputFormat ff_jv_demuxer = {
     .name           = "jv",
     .long_name      = NULL_IF_CONFIG_SMALL("Bitmap Brothers JV"),