[vlc-commits] aom: handle block allocation failure

Tristan Matthews git at videolan.org
Thu Dec 28 15:31:37 CET 2017


vlc | branch: master | Tristan Matthews <tmatth at videolan.org> | Thu Dec 28 09:14:12 2017 -0500| [54b82ad86a5119b2b8b3b19ece74a25f0f9dced5] | committer: Tristan Matthews

aom: handle block allocation failure

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=54b82ad86a5119b2b8b3b19ece74a25f0f9dced5
---

 modules/codec/aom.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/codec/aom.c b/modules/codec/aom.c
index 65055b80c2..6ecb694f25 100644
--- a/modules/codec/aom.c
+++ b/modules/codec/aom.c
@@ -454,6 +454,11 @@ static block_t *Encode(encoder_t *p_enc, picture_t *p_pict)
         {
             int keyframe = pkt->data.frame.flags & AOM_FRAME_IS_KEY;
             block_t *p_block = block_Alloc(pkt->data.frame.sz);
+            if (unlikely(p_block == NULL)) {
+                block_ChainRelease(p_out);
+                p_out = NULL;
+                break;
+            }
 
             /* FIXME: do this in-place */
             memcpy(p_block->p_buffer, pkt->data.frame.buf, pkt->data.frame.sz);



More information about the vlc-commits mailing list