[vlc-commits] access: mmsu: remove xmalloc

Francois Cartegnie git at videolan.org
Mon Dec 28 12:58:43 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Dec 27 23:22:03 2015 +0100| [03f61eff6a620fc979a84b80a019006f64b4477b] | committer: Francois Cartegnie

access: mmsu: remove xmalloc

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

 modules/access/mms/mmstu.c |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/modules/access/mms/mmstu.c b/modules/access/mms/mmstu.c
index b6d4e1b..5b44ff9 100644
--- a/modules/access/mms/mmstu.c
+++ b/modules/access/mms/mmstu.c
@@ -1133,11 +1133,18 @@ static int  mms_ParseCommand( access_t *p_access,
     uint32_t    i_id;
 
     free( p_sys->p_cmd );
-    p_sys->i_cmd = i_data;
-    p_sys->p_cmd = xmalloc( i_data );
-    memcpy( p_sys->p_cmd, p_data, i_data );
-
-    *pi_used = i_data; /* by default */
+    if( (p_sys->p_cmd = malloc( i_data )) )
+    {
+        p_sys->i_cmd = i_data;
+        memcpy( p_sys->p_cmd, p_data, i_data );
+        *pi_used = i_data; /* by default */
+    }
+    else
+    {
+        *pi_used = p_sys->i_cmd = 0;
+        p_sys->i_command = 0;
+        return -1;
+    }
 
     if( i_data < MMS_CMD_HEADERSIZE )
     {



More information about the vlc-commits mailing list