[vlc-commits] access: mmsu: remove xmalloc

Francois Cartegnie git at videolan.org
Mon Dec 28 23:35:53 CET 2015


vlc/vlc-2.2 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Dec 27 23:22:03 2015 +0100| [23661e2b1671c9dd742e7f78f62a777720a8541a] | committer: Jean-Baptiste Kempf

access: mmsu: remove xmalloc

(cherry picked from commit 03f61eff6a620fc979a84b80a019006f64b4477b)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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 6091fbd..5d1ce48 100644
--- a/modules/access/mms/mmstu.c
+++ b/modules/access/mms/mmstu.c
@@ -1144,11 +1144,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