diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 13303dc05900ae3f68d0a8f0a67133704979b457..d4108757c958a0a73d673ca667996ad5ab6409ed 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -5463,7 +5463,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
 
     if (!s->context_initialized) {
         if (ff_msmpeg4_decode_init(avctx) < 0 || ff_vc1_decode_init_alloc_tables(v) < 0)
-            return -1;
+            goto err;
 
         s->low_delay = !avctx->has_b_frames || v->res_sprite;