]> git.sesse.net Git - vlc/blobdiff - modules/access/mms/mmstu.c
Replace argument = realloc( argument, size ); with realloc_or_free() in modules/...
[vlc] / modules / access / mms / mmstu.c
index 4a860fd889ddba5b01b2f0da5176c7e783c3518f..89a772aefc1eeba2e41798d339bac902ab522f3c 100644 (file)
@@ -55,7 +55,7 @@
 #endif
 
 #include <vlc_network.h>
-#include "vlc_url.h"
+#include <vlc_url.h>
 #include "asf.h"
 #include "buffer.h"
 
@@ -604,6 +604,7 @@ static int MMSOpen( access_t  *p_access, vlc_url_t *p_url, int  i_proto )
     { \
         int i; \
         psz = malloc( size + 1); \
+        assert( psz ); \
         for( i = 0; i < size; i++ ) \
         { \
             psz[i] = p[i]; \
@@ -740,11 +741,11 @@ static int MMSOpen( access_t  *p_access, vlc_url_t *p_url, int  i_proto )
 
     msg_Dbg( p_access,
              "answer 0x06 flags:0x%8.8"PRIx32" media_length:%"PRIu32"s "
-             "packet_length:%u packet_count:%"PRId32" max_bit_rate:%d "
+             "packet_length:%zu packet_count:%"PRIu32" max_bit_rate:%d "
              "header_size:%zu",
              p_sys->i_flags_broadcast,
              p_sys->i_media_length,
-             (unsigned)p_sys->i_packet_length,
+             p_sys->i_packet_length,
              p_sys->i_packet_count,
              p_sys->i_max_bit_rate,
              p_sys->i_header_size );
@@ -1186,6 +1187,7 @@ static int  mms_ParseCommand( access_t *p_access,
     free( p_sys->p_cmd );
     p_sys->i_cmd = i_data;
     p_sys->p_cmd = malloc( i_data );
+    assert( p_sys->p_cmd );
     memcpy( p_sys->p_cmd, p_data, i_data );
 
     *pi_used = i_data; /* by default */
@@ -1308,8 +1310,9 @@ static int  mms_ParsePacket( access_t *p_access,
     {
         if( p_sys->p_header )
         {
-            p_sys->p_header = realloc( p_sys->p_header,
-                                          p_sys->i_header + i_packet_length - 8 );
+            p_sys->p_header = realloc_or_free( p_sys->p_header,
+                                      p_sys->i_header + i_packet_length - 8 );
+            assert( p_sys->p_header );
             memcpy( &p_sys->p_header[p_sys->i_header],
                     p_data + 8, i_packet_length - 8 );
             p_sys->i_header += i_packet_length - 8;
@@ -1318,6 +1321,7 @@ static int  mms_ParsePacket( access_t *p_access,
         else
         {
             uint8_t* p_packet = malloc( i_packet_length - 8 ); // don't bother with preheader
+            assert( p_packet );
             memcpy( p_packet, p_data + 8, i_packet_length - 8 );
             p_sys->p_header = p_packet;
             p_sys->i_header = i_packet_length - 8;
@@ -1331,6 +1335,7 @@ static int  mms_ParsePacket( access_t *p_access,
     else
     {
         uint8_t* p_packet = malloc( i_packet_length - 8 ); // don't bother with preheader
+        assert( p_packet );
         memcpy( p_packet, p_data + 8, i_packet_length - 8 );
         FREENULL( p_sys->p_media );
         p_sys->p_media = p_packet;