diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index d6386b40e045f1a0a4340e4ab4737beb0bcfa9e9..793f71a11fa1814ed5227c81a18e6fb333e095e4 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -472,7 +472,10 @@ static int alac_decode_frame(AVCodecContext *avctx,
                 ALAC_EXTRADATA_SIZE);
             return input_buffer_size;
         }
-        alac_set_info(alac);
+        if (alac_set_info(alac)) {
+            av_log(avctx, AV_LOG_ERROR, "alac: set_info failed\n");
+            return input_buffer_size;
+        }
         alac->context_initialized = 1;
     }
 
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index bf5a093a8822069c5f28da76ae86b500072c4107..358ecf23f6892194f1b72d35e754b74b5de8ec6e 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -335,7 +335,8 @@ static int shorten_decode_frame(AVCodecContext *avctx,
         }
         s->nwrap = FFMAX(NWRAP, maxnlpc);
 
-        allocate_buffers(s);
+        if (allocate_buffers(s))
+            return -1;
 
         init_offset(s);