[vlc-commits] vpx: encoder: free existing blocks on allocation failure

Tristan Matthews git at videolan.org
Tue Apr 17 19:45:27 CEST 2018


vlc | branch: master | Tristan Matthews <tmatth at videolan.org> | Tue Apr 17 11:19:50 2018 -0400| [9a5730783526780b1368cab56557913c3f7ff1bb] | committer: Tristan Matthews

vpx: encoder: free existing blocks on allocation failure

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

 modules/codec/vpx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/codec/vpx.c b/modules/codec/vpx.c
index 54a787ca74..643665023b 100644
--- a/modules/codec/vpx.c
+++ b/modules/codec/vpx.c
@@ -488,8 +488,9 @@ static block_t *Encode(encoder_t *p_enc, picture_t *p_pict)
             block_t *p_block = block_Alloc(pkt->data.frame.sz);
             if (unlikely(p_block == NULL))
             {
-                vpx_img_free(&img);
-                return NULL;
+                block_ChainRelease(p_out);
+                p_out = NULL;
+                break;
             }
 
             memcpy(p_block->p_buffer, pkt->data.frame.buf, pkt->data.frame.sz);



More information about the vlc-commits mailing list