[vlc-devel] [PATCH] config/chain: config_StringEscape: replace usage of xmalloc

Filip Roséen filip at atch.se
Thu May 18 12:59:18 CEST 2017


---
 src/config/chain.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/config/chain.c b/src/config/chain.c
index 660ad8fd98..e39ba2557a 100644
--- a/src/config/chain.c
+++ b/src/config/chain.c
@@ -481,7 +481,11 @@ char *config_StringEscape( const char *str )
     for( const char *p = str; *p; p++ )
         length += IsEscapeNeeded( *p ) ? 2 : 1;
 
-    char *ret = xmalloc( length + 1 ), *dst = ret;
+    char *ret = malloc( length + 1 ), *dst = ret;
+
+    if( unlikely( !ret ) )
+        return NULL;
+
     for( const char *p = str; *p; p++ )
     {
         if( IsEscapeNeeded( *p ) )
-- 
2.12.2


More information about the vlc-devel mailing list