]> git.sesse.net Git - vlc/blobdiff - modules/access/dshow/dshow.cpp
Replace argument = realloc( argument, size ); with realloc_or_free() in modules/...
[vlc] / modules / access / dshow / dshow.cpp
index b965bcd3d8e3a730e0afa3ee44f2fbd909d47fb4..bcdcda831e05d4a34d17b4a82e7cae11bf7b6830 100644 (file)
@@ -34,6 +34,8 @@
 #define __STDC_FORMAT_MACROS 1
 #include <inttypes.h>
 
+#include <assert.h>
+
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_input.h>
@@ -41,6 +43,7 @@
 #include <vlc_demux.h>
 #include <vlc_dialog.h>
 #include <vlc_charset.h>
+#include <vlc_memory.h>
 
 #include "common.h"
 #include "filter.h"
@@ -1101,8 +1104,9 @@ static int OpenDevice( vlc_object_t *p_this, access_sys_t *p_sys,
             dshow_stream.p_device_filter = p_device_filter;
             dshow_stream.p_capture_filter = p_capture_filter;
 
-            p_sys->pp_streams = (dshow_stream_t **)realloc( p_sys->pp_streams,
+            p_sys->pp_streams = realloc_or_free( p_sys->pp_streams,
                 sizeof(dshow_stream_t *) * (p_sys->i_streams + 1) );
+            assert( p_sys->pp_streams );
             p_sys->pp_streams[p_sys->i_streams] = new dshow_stream_t;
             *p_sys->pp_streams[p_sys->i_streams++] = dshow_stream;
 
@@ -1963,12 +1967,12 @@ static int FindDevicesCallback( vlc_object_t *p_this, char const *psz_name,
 
     if( !list_devices.size() ) return VLC_SUCCESS;
 
-    p_item->ppsz_list =
-        (char **)realloc( p_item->ppsz_list,
+    p_item->ppsz_list = realloc_or_free( p_item->ppsz_list,
                           (list_devices.size()+3) * sizeof(char *) );
-    p_item->ppsz_list_text =
-        (char **)realloc( p_item->ppsz_list_text,
+    assert( p_item->ppsz_list );
+    p_item->ppsz_list_text = realloc_or_free( p_item->ppsz_list_text,
                           (list_devices.size()+3) * sizeof(char *) );
+    assert( p_item->ppsz_list_text );
 
     list<string>::iterator iter;
     for( iter = list_devices.begin(), i = 2; iter != list_devices.end();