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

Filip Roséen git at videolan.org
Thu May 18 18:21:18 CEST 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Thu May 18 12:59:18 2017 +0200| [c084b38d70ff064b9ae630946f157ca302224448] | committer: Rémi Denis-Courmont

config/chain: config_StringEscape: replace usage of xmalloc

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 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 ) )



More information about the vlc-commits mailing list