diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index ebeda9b7a57be3463ae5b83c521c75602cac9f3d..7b306c9c41ff375c7b90291782d837fbf387ca03 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -819,7 +819,7 @@ static int decode_eld_specific_config(AACContext *ac, AVCodecContext *avctx,
         if (len == 15 + 255)
             len += get_bits(gb, 16);
         if (get_bits_left(gb) < len * 8 + 4) {
-            av_log(ac->avctx, AV_LOG_ERROR, overread_err);
+            av_log(avctx, AV_LOG_ERROR, overread_err);
             return AVERROR_INVALIDDATA;
         }
         skip_bits_long(gb, 8 * len);