[vlc-devel] [RFC 25/38] codec/subsdec: replaced usage of xmalloc

Filip Roséen filip at videolabs.io
Mon Jun 27 13:43:36 CEST 2016


---
 modules/codec/subsdec.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/codec/subsdec.c b/modules/codec/subsdec.c
index 29504d2..c90beab 100644
--- a/modules/codec/subsdec.c
+++ b/modules/codec/subsdec.c
@@ -418,7 +418,14 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
         {
             size_t inbytes_left = strlen( psz_subtitle );
             size_t outbytes_left = 6 * inbytes_left;
-            char *psz_new_subtitle = xmalloc( outbytes_left + 1 );
+            char *psz_new_subtitle = malloc( outbytes_left + 1 );
+
+            if( unlikely( !psz_new_subtitle ) )
+            {
+                free( psz_subtitle );
+                return NULL;
+            }
+
             char *psz_convert_buffer_out = psz_new_subtitle;
             const char *psz_convert_buffer_in = psz_subtitle;
 
-- 
2.9.0



More information about the vlc-devel mailing list