diff --git a/libavformat/movenc-test.c b/libavformat/movenc-test.c
index d494e41e015a208b0b5fdb41dc12e49bd5dd6720..957ae69a3a5945fc13ccda441430856533cb485e 100644
--- a/libavformat/movenc-test.c
+++ b/libavformat/movenc-test.c
@@ -137,6 +137,7 @@ static void check_func(int value, int line, const char *msg, ...)
         vprintf(msg, ap);
         printf("\n");
         check_faults++;
+        va_end(ap);
     }
 }
 #define check(value, ...) check_func(value, __LINE__, __VA_ARGS__)