Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
25232e20
Commit
25232e20
authored
Dec 06, 2009
by
Rémi Denis-Courmont
Browse files
Do not assert memory allocations
parent
34ad70b4
Changes
51
Hide whitespace changes
Inline
Side-by-side
modules/access/dshow/dshow.cpp
View file @
25232e20
...
...
@@ -34,8 +34,6 @@
#define __STDC_FORMAT_MACROS 1
#include <inttypes.h>
#include <assert.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_input.h>
...
...
@@ -43,7 +41,6 @@
#include <vlc_demux.h>
#include <vlc_dialog.h>
#include <vlc_charset.h>
#include <vlc_memory.h>
#include "common.h"
#include "filter.h"
...
...
@@ -1104,10 +1101,8 @@ 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_or_free
(
p_sys
->
pp_streams
,
p_sys
->
pp_streams
=
(
dshow_stream_t
**
)
xrealloc
(
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
;
...
...
@@ -1968,12 +1963,10 @@ 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
_or_free
(
p_item
->
ppsz_list
,
p_item
->
ppsz_list
=
(
char
**
)
x
realloc
(
p_item
->
ppsz_list
,
(
list_devices
.
size
()
+
3
)
*
sizeof
(
char
*
)
);
assert
(
p_item
->
ppsz_list
);
p_item
->
ppsz_list_text
=
(
char
**
)
realloc_or_free
(
p_item
->
ppsz_list_text
,
p_item
->
ppsz_list_text
=
(
char
**
)
xrealloc
(
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
();
...
...
modules/access/dvb/en50221.c
View file @
25232e20
...
...
@@ -272,8 +272,7 @@ static int TPDURecv( access_t * p_access, uint8_t i_slot, uint8_t *pi_tag,
if
(
pi_size
==
NULL
)
{
p_data
=
malloc
(
MAX_TPDU_SIZE
);
assert
(
p_data
);
p_data
=
xmalloc
(
MAX_TPDU_SIZE
);
}
for
(
;
;
)
...
...
@@ -354,13 +353,11 @@ static int SPDUSend( access_t * p_access, int i_session_id,
uint8_t
*
p_data
,
int
i_size
)
{
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
uint8_t
*
p_spdu
=
malloc
(
i_size
+
4
);
uint8_t
*
p_spdu
=
x
malloc
(
i_size
+
4
);
uint8_t
*
p
=
p_spdu
;
uint8_t
i_tag
;
uint8_t
i_slot
=
p_sys
->
p_sessions
[
i_session_id
-
1
].
i_slot
;
assert
(
p_spdu
);
*
p
++
=
ST_SESSION_NUMBER
;
*
p
++
=
0x02
;
*
p
++
=
(
i_session_id
>>
8
);
...
...
@@ -804,13 +801,11 @@ static int APDUSend( access_t * p_access, int i_session_id, int i_tag,
uint8_t
*
p_data
,
int
i_size
)
{
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
uint8_t
*
p_apdu
=
malloc
(
i_size
+
12
);
uint8_t
*
p_apdu
=
x
malloc
(
i_size
+
12
);
uint8_t
*
p
=
p_apdu
;
ca_msg_t
ca_msg
;
int
i_ret
;
assert
(
p_apdu
);
*
p
++
=
(
i_tag
>>
16
);
*
p
++
=
(
i_tag
>>
8
)
&
0xff
;
*
p
++
=
i_tag
&
0xff
;
...
...
@@ -1052,11 +1047,9 @@ static uint8_t *CAPMTHeader( system_ids_t *p_ids, uint8_t i_list_mgt,
uint8_t
*
p_data
;
if
(
i_size
)
p_data
=
malloc
(
7
+
i_size
);
p_data
=
x
malloc
(
7
+
i_size
);
else
p_data
=
malloc
(
6
);
assert
(
p_data
);
p_data
=
xmalloc
(
6
);
p_data
[
0
]
=
i_list_mgt
;
p_data
[
1
]
=
i_program_number
>>
8
;
...
...
@@ -1108,11 +1101,9 @@ static uint8_t *CAPMTES( system_ids_t *p_ids, uint8_t *p_capmt,
int
i
;
if
(
i_size
)
p_data
=
realloc
(
p_capmt
,
i_capmt_size
+
6
+
i_size
);
p_data
=
x
realloc
(
p_capmt
,
i_capmt_size
+
6
+
i_size
);
else
p_data
=
realloc
(
p_capmt
,
i_capmt_size
+
5
);
assert
(
p_data
);
p_data
=
xrealloc
(
p_capmt
,
i_capmt_size
+
5
);
i
=
i_capmt_size
;
...
...
@@ -1581,8 +1572,7 @@ static void MMISendObject( access_t *p_access, int i_session_id,
case
EN50221_MMI_ANSW
:
i_tag
=
AOT_ANSW
;
i_size
=
1
+
strlen
(
p_object
->
u
.
answ
.
psz_answ
);
p_data
=
malloc
(
i_size
);
assert
(
p_data
);
p_data
=
xmalloc
(
i_size
);
p_data
[
0
]
=
(
p_object
->
u
.
answ
.
b_ok
==
true
)
?
0x1
:
0x0
;
strncpy
(
(
char
*
)
&
p_data
[
1
],
p_object
->
u
.
answ
.
psz_answ
,
i_size
-
1
);
break
;
...
...
@@ -1590,8 +1580,7 @@ static void MMISendObject( access_t *p_access, int i_session_id,
case
EN50221_MMI_MENU_ANSW
:
i_tag
=
AOT_MENU_ANSW
;
i_size
=
1
;
p_data
=
malloc
(
i_size
);
assert
(
p_data
);
p_data
=
xmalloc
(
i_size
);
p_data
[
0
]
=
p_object
->
u
.
menu_answ
.
i_choice
;
break
;
...
...
@@ -1677,8 +1666,7 @@ static void MMIHandleEnq( access_t *p_access, int i_session_id,
p_mmi
->
last_object
.
u
.
enq
.
b_blind
=
(
*
d
&
0x1
)
?
true
:
false
;
d
+=
2
;
/* skip answer_text_length because it is not mandatory */
l
-=
2
;
p_mmi
->
last_object
.
u
.
enq
.
psz_text
=
malloc
(
l
+
1
);
assert
(
p_mmi
->
last_object
.
u
.
enq
.
psz_text
);
p_mmi
->
last_object
.
u
.
enq
.
psz_text
=
xmalloc
(
l
+
1
);
strncpy
(
p_mmi
->
last_object
.
u
.
enq
.
psz_text
,
(
char
*
)
d
,
l
);
p_mmi
->
last_object
.
u
.
enq
.
psz_text
[
l
]
=
'\0'
;
...
...
@@ -1820,9 +1808,8 @@ static void MMIOpen( access_t *p_access, int i_session_id )
p_sys
->
p_sessions
[
i_session_id
-
1
].
pf_handle
=
MMIHandle
;
p_sys
->
p_sessions
[
i_session_id
-
1
].
pf_close
=
MMIClose
;
p_sys
->
p_sessions
[
i_session_id
-
1
].
p_sys
=
malloc
(
sizeof
(
mmi_t
));
p_sys
->
p_sessions
[
i_session_id
-
1
].
p_sys
=
x
malloc
(
sizeof
(
mmi_t
));
p_mmi
=
(
mmi_t
*
)
p_sys
->
p_sessions
[
i_session_id
-
1
].
p_sys
;
assert
(
p_mmi
);
p_mmi
->
last_object
.
i_object_type
=
EN50221_MMI_NONE
;
}
...
...
@@ -2452,8 +2439,7 @@ char *dvbsi_to_utf8( const char *psz_instring, size_t i_length )
iconv_handle
=
vlc_iconv_open
(
"UTF-8"
,
psz_encoding
);
i_in
=
i_length
-
(
psz_stringstart
-
psz_instring
);
i_out
=
i_in
*
6
;
psz_outstring
=
psz_tmp
=
(
char
*
)
malloc
(
i_out
+
1
);
assert
(
psz_outstring
);
psz_outstring
=
psz_tmp
=
(
char
*
)
xmalloc
(
i_out
+
1
);
vlc_iconv
(
iconv_handle
,
&
psz_stringstart
,
&
i_in
,
&
psz_tmp
,
&
i_out
);
vlc_iconv_close
(
iconv_handle
);
*
psz_tmp
=
'\0'
;
...
...
modules/access/jack.c
View file @
25232e20
...
...
@@ -541,9 +541,8 @@ static void Port_finder( demux_t *p_demux )
i_out_ports
++
;
}
/* alloc an array to store all the matched ports */
p_sys
->
pp_jack_port_table
=
realloc
(
p_sys
->
pp_jack_port_table
,
p_sys
->
pp_jack_port_table
=
x
realloc
(
p_sys
->
pp_jack_port_table
,
(
i_out_ports
*
sizeof
(
char
*
)
+
i_total_out_ports
*
sizeof
(
char
*
)
)
);
assert
(
p_sys
->
pp_jack_port_table
);
for
(
int
i
=
0
;
i
<
i_out_ports
;
i
++
)
{
...
...
modules/access/mms/buffer.c
View file @
25232e20
...
...
@@ -29,10 +29,7 @@
# include "config.h"
#endif
#include <assert.h>
#include <vlc_common.h>
#include <vlc_memory.h>
#include "asf.h"
#include "buffer.h"
...
...
@@ -71,8 +68,7 @@ void var_buffer_add8 ( var_buffer_t *p_buf, uint8_t i_byte )
if
(
p_buf
->
i_data
>=
p_buf
->
i_size
)
{
p_buf
->
i_size
+=
1024
;
p_buf
->
p_data
=
realloc_or_free
(
p_buf
->
p_data
,
p_buf
->
i_size
);
assert
(
p_buf
->
p_data
);
p_buf
->
p_data
=
xrealloc
(
p_buf
->
p_data
,
p_buf
->
i_size
);
}
p_buf
->
p_data
[
p_buf
->
i_data
]
=
i_byte
&
0xff
;
p_buf
->
i_data
++
;
...
...
@@ -102,8 +98,7 @@ void var_buffer_addmemory( var_buffer_t *p_buf, void *p_mem, int i_mem )
if
(
p_buf
->
i_data
+
i_mem
>=
p_buf
->
i_size
)
{
p_buf
->
i_size
+=
i_mem
+
1024
;
p_buf
->
p_data
=
realloc_or_free
(
p_buf
->
p_data
,
p_buf
->
i_size
);
assert
(
p_buf
->
p_data
);
p_buf
->
p_data
=
xrealloc
(
p_buf
->
p_data
,
p_buf
->
i_size
);
}
memcpy
(
p_buf
->
p_data
+
p_buf
->
i_data
,
p_mem
,
i_mem
);
...
...
@@ -124,8 +119,7 @@ void var_buffer_addUTF16( var_buffer_t *p_buf, const char *p_str )
size_t
i_out
=
i_in
*
4
;
char
*
psz_out
,
*
psz_tmp
;
psz_out
=
psz_tmp
=
malloc
(
i_out
+
1
);
assert
(
psz_out
);
psz_out
=
psz_tmp
=
xmalloc
(
i_out
+
1
);
iconv_handle
=
vlc_iconv_open
(
"UTF-16LE"
,
"UTF-8"
);
vlc_iconv
(
iconv_handle
,
&
p_str
,
&
i_in
,
&
psz_tmp
,
&
i_out
);
vlc_iconv_close
(
iconv_handle
);
...
...
modules/access/mms/mmsh.c
View file @
25232e20
...
...
@@ -29,13 +29,10 @@
# include "config.h"
#endif
#include <assert.h>
#include <vlc_common.h>
#include <vlc_access.h>
#include <vlc_strings.h>
#include <vlc_input.h>
#include <vlc_memory.h>
#include <vlc_network.h>
#include <vlc_url.h>
...
...
@@ -737,8 +734,7 @@ static void GetHeader( access_t *p_access )
if
(
ck
.
i_data
>
0
)
{
p_sys
->
i_header
+=
ck
.
i_data
;
p_sys
->
p_header
=
realloc_or_free
(
p_sys
->
p_header
,
p_sys
->
i_header
);
assert
(
p_sys
->
p_header
);
p_sys
->
p_header
=
xrealloc
(
p_sys
->
p_header
,
p_sys
->
i_header
);
memcpy
(
&
p_sys
->
p_header
[
p_sys
->
i_header
-
ck
.
i_data
],
ck
.
p_data
,
ck
.
i_data
);
}
...
...
modules/access/mms/mmstu.c
View file @
25232e20
...
...
@@ -31,7 +31,6 @@
#include <vlc_common.h>
#include <vlc_access.h>
#include <vlc_memory.h>
#include <errno.h>
#include <assert.h>
...
...
@@ -604,8 +603,7 @@ static int MMSOpen( access_t *p_access, vlc_url_t *p_url, int i_proto )
#define GETUTF16( psz, size ) \
{ \
int i; \
psz = malloc( size + 1); \
assert( psz ); \
psz = xmalloc( size + 1); \
for( i = 0; i < size; i++ ) \
{ \
psz[i] = p[i]; \
...
...
@@ -1187,8 +1185,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
);
p_sys
->
p_cmd
=
xmalloc
(
i_data
);
memcpy
(
p_sys
->
p_cmd
,
p_data
,
i_data
);
*
pi_used
=
i_data
;
/* by default */
...
...
@@ -1311,9 +1308,8 @@ static int mms_ParsePacket( access_t *p_access,
{
if
(
p_sys
->
p_header
)
{
p_sys
->
p_header
=
realloc
_or_free
(
p_sys
->
p_header
,
p_sys
->
p_header
=
x
realloc
(
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
;
...
...
@@ -1321,8 +1317,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
);
uint8_t
*
p_packet
=
xmalloc
(
i_packet_length
-
8
);
// don't bother with preheader
memcpy
(
p_packet
,
p_data
+
8
,
i_packet_length
-
8
);
p_sys
->
p_header
=
p_packet
;
p_sys
->
i_header
=
i_packet_length
-
8
;
...
...
@@ -1335,8 +1330,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
);
uint8_t
*
p_packet
=
xmalloc
(
i_packet_length
-
8
);
// don't bother with preheader
memcpy
(
p_packet
,
p_data
+
8
,
i_packet_length
-
8
);
FREENULL
(
p_sys
->
p_media
);
p_sys
->
p_media
=
p_packet
;
...
...
modules/access_output/http.c
View file @
25232e20
...
...
@@ -30,15 +30,14 @@
# include "config.h"
#endif
#include <assert.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_sout.h>
#include <vlc_block.h>
#include <vlc_input.h>
#include <vlc_playlist.h>
#include <vlc_memory.h>
#if 0 //def HAVE_AVAHI_CLIENT
#include "bonjour.h"
...
...
@@ -318,18 +317,13 @@ static int Open( vlc_object_t *p_this )
p_sys
->
i_header_allocated
=
1024
;
p_sys
->
i_header_size
=
0
;
p_sys
->
p_header
=
malloc
(
p_sys
->
i_header_allocated
);
p_sys
->
p_header
=
x
malloc
(
p_sys
->
i_header_allocated
);
p_sys
->
b_header_complete
=
false
;
if
(
!
p_sys
->
p_header
)
p_sys
->
i_header_allocated
=
0
;
p_access
->
pf_write
=
Write
;
p_access
->
pf_seek
=
Seek
;
p_access
->
pf_control
=
Control
;
/* XXX Do we deal gracefully with p_sys->p_header == NULL? */
assert
(
p_sys
->
p_header
);
return
VLC_SUCCESS
;
}
...
...
@@ -399,9 +393,8 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
{
p_sys
->
i_header_allocated
=
p_buffer
->
i_buffer
+
p_sys
->
i_header_size
+
1024
;
p_sys
->
p_header
=
realloc
_or_free
(
p_sys
->
p_header
,
p_sys
->
p_header
=
x
realloc
(
p_sys
->
p_header
,
p_sys
->
i_header_allocated
);
assert
(
p_sys
->
p_header
);
}
memcpy
(
&
p_sys
->
p_header
[
p_sys
->
i_header_size
],
p_buffer
->
p_buffer
,
...
...
modules/audio_filter/converter/dtstospdif.c
View file @
25232e20
...
...
@@ -28,16 +28,12 @@
# include "config.h"
#endif
#include <assert.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_aout.h>
#include <vlc_filter.h>
#include <vlc_memory.h>
/*****************************************************************************
* Local structures
*****************************************************************************/
...
...
@@ -129,9 +125,8 @@ static block_t *DoWork( filter_t * p_filter, block_t * p_in_buf )
p_filter
->
p_sys
->
i_frame_size
,
p_in_buf
->
i_buffer
);
p_filter
->
p_sys
->
i_frame_size
=
p_in_buf
->
i_buffer
;
p_filter
->
p_sys
->
p_buf
=
realloc
_or_free
(
p_filter
->
p_sys
->
p_buf
,
p_filter
->
p_sys
->
p_buf
=
x
realloc
(
p_filter
->
p_sys
->
p_buf
,
p_in_buf
->
i_buffer
*
3
);
assert
(
p_filter
->
p_sys
->
p_buf
);
p_filter
->
p_sys
->
i_frames
=
0
;
}
...
...
modules/audio_output/alsa.c
View file @
25232e20
...
...
@@ -42,8 +42,6 @@
#include <vlc_aout.h>
#include <vlc_cpu.h>
#include <vlc_memory.h>
/* ALSA part
Note: we use the new API which is available since 0.9.0beta10a. */
#define ALSA_PCM_NEW_HW_PARAMS_API
...
...
@@ -1004,12 +1002,10 @@ static void GetDevicesForCard( module_config_t *p_item, int i_card )
break
;
}
p_item
->
ppsz_list
=
realloc
_or_free
(
p_item
->
ppsz_list
,
p_item
->
ppsz_list
=
x
realloc
(
p_item
->
ppsz_list
,
(
p_item
->
i_list
+
2
)
*
sizeof
(
char
*
)
);
assert
(
p_item
->
ppsz_list
);
p_item
->
ppsz_list_text
=
realloc_or_free
(
p_item
->
ppsz_list_text
,
p_item
->
ppsz_list_text
=
xrealloc
(
p_item
->
ppsz_list_text
,
(
p_item
->
i_list
+
2
)
*
sizeof
(
char
*
)
);
assert
(
p_item
->
ppsz_list_text
);
p_item
->
ppsz_list
[
p_item
->
i_list
]
=
psz_device
;
p_item
->
ppsz_list_text
[
p_item
->
i_list
]
=
psz_descr
;
p_item
->
i_list
++
;
...
...
modules/audio_output/waveout.c
View file @
25232e20
...
...
@@ -30,13 +30,10 @@
# include "config.h"
#endif
#include <assert.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_aout.h>
#include <vlc_charset.h>
#include <vlc_memory.h>
#include <windows.h>
#include <mmsystem.h>
...
...
@@ -1174,12 +1171,10 @@ static int ReloadWaveoutDevices( vlc_object_t *p_this, char const *psz_name,
int
wave_devices
=
waveOutGetNumDevs
();
p_item
->
ppsz_list
=
realloc
_or_free
(
p_item
->
ppsz_list
,
p_item
->
ppsz_list
=
x
realloc
(
p_item
->
ppsz_list
,
(
wave_devices
+
2
)
*
sizeof
(
char
*
)
);
assert
(
p_item
->
ppsz_list
);
p_item
->
ppsz_list_text
=
realloc_or_free
(
p_item
->
ppsz_list_text
,
p_item
->
ppsz_list_text
=
xrealloc
(
p_item
->
ppsz_list_text
,
(
wave_devices
+
2
)
*
sizeof
(
char
*
)
);
assert
(
p_item
->
ppsz_list_text
);
WAVEOUTCAPS
caps
;
char
sz_dev_name
[
MAXPNAMELEN
+
32
];
...
...
modules/codec/cmml/xurl.c
View file @
25232e20
...
...
@@ -28,9 +28,6 @@
#endif
#include <stdio.h>
#include <assert.h>
#include <vlc_memory.h>
#include "xurl.h"
...
...
@@ -385,8 +382,7 @@ char *XURL_GetHead( const char *psz_path )
size_t
i_characters_until_last_slash
;
i_characters_until_last_slash
=
pc_last_slash
-
psz_path
;
psz_path_head
=
malloc
(
i_characters_until_last_slash
+
1
);
assert
(
psz_path_head
);
psz_path_head
=
xmalloc
(
i_characters_until_last_slash
+
1
);
strncpy
(
psz_path_head
,
psz_path
,
i_characters_until_last_slash
+
1
);
/* terminate the resulting string with '\0' */
...
...
@@ -439,8 +435,7 @@ static char *streallocat( char *psz_string, const char *psz_to_append )
size_t
i_new_string_length
=
strlen
(
psz_string
)
+
strlen
(
psz_to_append
)
+
1
;
psz_string
=
realloc_or_free
(
psz_string
,
i_new_string_length
);
assert
(
psz_string
);
psz_string
=
xrealloc
(
psz_string
,
i_new_string_length
);
return
strcat
(
psz_string
,
psz_to_append
);
}
...
...
modules/codec/dvbsub.c
View file @
25232e20
...
...
@@ -71,13 +71,10 @@
# include "config.h"
#endif
#include <assert.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
#include <vlc_sout.h>
#include <vlc_memory.h>
#include <vlc_bits.h>
...
...
@@ -916,8 +913,7 @@ static void decode_region_composition( decoder_t *p_dec, bs_t *s )
free
(
p_region
->
p_pixbuf
);
}
p_region
->
p_pixbuf
=
malloc
(
i_height
*
i_width
);
assert
(
p_region
->
p_pixbuf
);
p_region
->
p_pixbuf
=
xmalloc
(
i_height
*
i_width
);
p_region
->
i_depth
=
0
;
b_fill
=
true
;
}
...
...
@@ -951,9 +947,8 @@ static void decode_region_composition( decoder_t *p_dec, bs_t *s )
/* We create a new object */
p_region
->
i_object_defs
++
;
p_region
->
p_object_defs
=
realloc
_or_free
(
p_region
->
p_object_defs
,
p_region
->
p_object_defs
=
x
realloc
(
p_region
->
p_object_defs
,
sizeof
(
dvbsub_objectdef_t
)
*
p_region
->
i_object_defs
);
assert
(
p_region
->
p_object_defs
);
/* We parse object properties */
p_obj
=
&
p_region
->
p_object_defs
[
p_region
->
i_object_defs
-
1
];
...
...
@@ -1169,9 +1164,8 @@ static void decode_object( decoder_t *p_dec, bs_t *s )
if
(
p_region
->
p_object_defs
[
i
].
i_id
!=
i_id
)
continue
;
p_region
->
p_object_defs
[
i
].
psz_text
=
realloc
_or_free
(
p_region
->
p_object_defs
[
i
].
psz_text
,
x
realloc
(
p_region
->
p_object_defs
[
i
].
psz_text
,
i_number_of_codes
+
1
);
assert
(
p_region
->
p_object_defs
[
i
].
psz_text
);
/* FIXME 16bits -> char ??? See Preamble */
for
(
j
=
0
;
j
<
i_number_of_codes
;
j
++
)
...
...
@@ -1843,9 +1837,8 @@ static subpicture_t *YuvaYuvp( subpicture_t *p_subpic )
#endif
#ifndef RANDOM_DITHERING
pi_delta
=
malloc
(
(
p_region
->
p_picture
->
p
[
0
].
i_pitch
+
1
)
pi_delta
=
x
malloc
(
(
p_region
->
p_picture
->
p
[
0
].
i_pitch
+
1
)
*
sizeof
(
int
)
*
4
);
assert
(
pi_delta
);
for
(
i
=
0
;
i
<
(
p_region
->
p_picture
->
p
[
0
].
i_pitch
+
1
)
*
4
;
i
++
)
{
pi_delta
[
i
]
=
0
;
...
...
@@ -2084,9 +2077,8 @@ static void encode_page_composition( encoder_t *p_enc, bs_t *s,
{
encoder_region_t
region
;
region
.
i_width
=
region
.
i_height
=
0
;
p_sys
->
p_regions
=
realloc
_or_free
(
p_sys
->
p_regions
,
p_sys
->
p_regions
=
x
realloc
(
p_sys
->
p_regions
,
sizeof
(
encoder_region_t
)
*
(
p_sys
->
i_regions
+
1
)
);
assert
(
p_sys
->
p_regions
);
p_sys
->
p_regions
[
p_sys
->
i_regions
++
]
=
region
;
}
...
...
modules/codec/flac.c
View file @
25232e20
...
...
@@ -30,13 +30,10 @@
# include "config.h"
#endif
#include <assert.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
#include <vlc_aout.h>
#include <vlc_memory.h>
#ifdef HAVE_FLAC_STREAM_DECODER_H
# include <FLAC/stream_decoder.h>
...
...
@@ -365,9 +362,8 @@ static void ProcessHeader( decoder_t *p_dec )
if
(
p_dec
->
fmt_out
.
i_codec
==
VLC_CODEC_FLAC
)
{
p_dec
->
fmt_out
.
i_extra
=
p_dec
->
fmt_in
.
i_extra
;
p_dec
->
fmt_out
.
p_extra
=
realloc
_or_free
(
p_dec
->
fmt_out
.
p_extra
,
p_dec
->
fmt_out
.
p_extra
=
x
realloc
(
p_dec
->
fmt_out
.
p_extra
,
p_dec
->
fmt_out
.
i_extra
);
/*assert( p_dec->fmt_out.p_extra ); assert undefined here? */
memcpy
(
p_dec
->
fmt_out
.
p_extra
,
p_dec
->
fmt_in
.
p_extra
,
p_dec
->
fmt_out
.
i_extra
);
}
...
...
@@ -1372,8 +1368,7 @@ static block_t *Encode( encoder_t *p_enc, aout_buffer_t *p_aout_buf )
if
(
p_sys
->
i_buffer
<
p_aout_buf
->
i_buffer
*
2
)
{
p_sys
->
p_buffer
=
realloc_or_free
(
p_sys
->
p_buffer
,
p_aout_buf
->
i_buffer
*
2
);
assert
(
p_sys
->
p_buffer
);
xrealloc
(
p_sys
->
p_buffer
,
p_aout_buf
->
i_buffer
*
2
);
p_sys
->
i_buffer
=
p_aout_buf
->
i_buffer
*
2
;
}
...
...
@@ -1441,8 +1436,7 @@ EncoderWriteCallback( const FLAC__StreamEncoder *encoder,
/* Backup the STREAMINFO metadata block */
p_enc
->
fmt_out
.
i_extra
=
STREAMINFO_SIZE
+
4
;
p_enc
->
fmt_out
.
p_extra
=
malloc
(
STREAMINFO_SIZE
+
4
);
assert
(
p_enc
->
fmt_out
.
p_extra
);
p_enc
->
fmt_out
.
p_extra
=
xmalloc
(
STREAMINFO_SIZE
+
4
);
memcpy
(
p_enc
->
fmt_out
.
p_extra
,
"fLaC"
,
4
);
memcpy
(
((
uint8_t
*
)
p_enc
->
fmt_out
.
p_extra
)
+
4
,
buffer
,
STREAMINFO_SIZE
);
...
...
modules/codec/kate.c
View file @
25232e20
...
...
@@ -28,14 +28,11 @@
# include "config.h"
#endif
#include <assert.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_input.h>
#include <vlc_codec.h>
#include <vlc_osd.h>
#include <vlc_memory.h>
#include <kate/kate.h>
#ifdef HAVE_TIGER
...
...
@@ -506,9 +503,8 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
/* Backup headers as extra data */
uint8_t
*
p_extra
;
p_dec
->
fmt_in
.
p_extra
=
realloc
_or_free
(
p_dec
->
fmt_in
.
p_extra
,
p_dec
->
fmt_in
.
p_extra
=
x
realloc
(
p_dec
->
fmt_in
.
p_extra
,
p_dec
->
fmt_in
.
i_extra
+
kp
.
nbytes
+
2
);
assert
(
p_dec
->
fmt_in
.
p_extra
);
p_extra
=
(
void
*
)(((
unsigned
char
*
)
p_dec
->
fmt_in
.
p_extra
)
+
p_dec
->
fmt_in
.
i_extra
);
*
(
p_extra
++
)
=
kp
.
nbytes
>>
8
;
*
(
p_extra
++
)
=
kp
.
nbytes
&
0xFF
;
...
...
@@ -628,9 +624,8 @@ static int ProcessHeaders( decoder_t *p_dec )
else
{
p_dec
->
fmt_out
.
i_extra
=
p_dec
->
fmt_in
.
i_extra
;
p_dec
->
fmt_out
.
p_extra
=
realloc
_or_free
(
p_dec
->
fmt_out
.
p_extra
,
p_dec
->
fmt_out
.
p_extra
=
x
realloc
(
p_dec
->
fmt_out
.
p_extra
,
p_dec
->
fmt_out
.
i_extra
);
assert
(
p_dec
->
fmt_out
.
p_extra
);
memcpy
(
p_dec
->
fmt_out
.
p_extra
,
p_dec
->
fmt_in
.
p_extra
,
p_dec
->
fmt_out
.
i_extra
);
}
...
...
modules/codec/quicktime.c
View file @
25232e20
...
...
@@ -30,13 +30,10 @@
# include "config.h"
#endif
#include <assert.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_aout.h>
#include <vlc_codec.h>
#include <vlc_memory.h>
#if !defined (__APPLE__) && !defined(WIN32)
# define LOADER 1
...
...
@@ -585,8 +582,7 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
if
(
p_sys
->
i_buffer_size
<
p_sys
->
i_buffer
+
p_block
->
i_buffer
)
{
p_sys
->
i_buffer_size
=
p_sys
->
i_buffer
+
p_block
->
i_buffer
+
1024
;