diff --git a/libavcodec/adxenc.c b/libavcodec/adxenc.c
index ca472e0f9dd3436b50bc174d450fd2e77640a04c..bcb89672664e740b6c14a047529aeebb977575c8 100644
--- a/libavcodec/adxenc.c
+++ b/libavcodec/adxenc.c
@@ -118,9 +118,8 @@ static av_cold int adx_encode_init(AVCodecContext *avctx)
     avctx->frame_size = BLOCK_SAMPLES;
 
 #if FF_API_OLD_ENCODE_AUDIO
-    avctx->coded_frame = avcodec_alloc_frame();
-    if (!avctx->coded_frame)
-        return AVERROR(ENOMEM);
+    avcodec_get_frame_defaults(&c->frame);
+    avctx->coded_frame = &c->frame;
 #endif
 
     /* the cutoff can be adjusted, but this seems to work pretty well */