Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
ad08a9c3
Commit
ad08a9c3
authored
Dec 13, 2008
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use calloc instead of malloc+memset.
parent
ea4894d2
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
27 additions
and
56 deletions
+27
-56
modules/access/dvb/en50221.c
modules/access/dvb/en50221.c
+2
-5
modules/access_filter/bandwidth.c
modules/access_filter/bandwidth.c
+3
-3
modules/access_filter/dump.c
modules/access_filter/dump.c
+2
-3
modules/access_output/bonjour.c
modules/access_output/bonjour.c
+1
-5
modules/audio_output/pulse.c
modules/audio_output/pulse.c
+1
-2
modules/codec/avcodec/encoder.c
modules/codec/avcodec/encoder.c
+1
-2
modules/codec/avcodec/video.c
modules/codec/avcodec/video.c
+1
-5
modules/codec/cc.c
modules/codec/cc.c
+1
-4
modules/codec/cdg.c
modules/codec/cdg.c
+1
-4
modules/codec/csri.c
modules/codec/csri.c
+1
-2
modules/misc/rtsp.c
modules/misc/rtsp.c
+8
-10
modules/mux/mpeg/csa.c
modules/mux/mpeg/csa.c
+2
-5
modules/mux/ogg.c
modules/mux/ogg.c
+2
-4
modules/stream_out/transcode.c
modules/stream_out/transcode.c
+1
-2
No files found.
modules/access/dvb/en50221.c
View file @
ad08a9c3
...
...
@@ -1368,9 +1368,7 @@ static void ConditionalAccessOpen( access_t * p_access, int i_session_id )
p_sys
->
p_sessions
[
i_session_id
-
1
].
pf_handle
=
ConditionalAccessHandle
;
p_sys
->
p_sessions
[
i_session_id
-
1
].
pf_close
=
ConditionalAccessClose
;
p_sys
->
p_sessions
[
i_session_id
-
1
].
p_sys
=
malloc
(
sizeof
(
system_ids_t
));
memset
(
p_sys
->
p_sessions
[
i_session_id
-
1
].
p_sys
,
0
,
sizeof
(
system_ids_t
)
);
p_sys
->
p_sessions
[
i_session_id
-
1
].
p_sys
=
calloc
(
1
,
sizeof
(
system_ids_t
)
);
APDUSend
(
p_access
,
i_session_id
,
AOT_CA_INFO_ENQ
,
NULL
,
0
);
}
...
...
@@ -1500,8 +1498,7 @@ static void DateTimeOpen( access_t * p_access, int i_session_id )
p_sys
->
p_sessions
[
i_session_id
-
1
].
pf_handle
=
DateTimeHandle
;
p_sys
->
p_sessions
[
i_session_id
-
1
].
pf_manage
=
DateTimeManage
;
p_sys
->
p_sessions
[
i_session_id
-
1
].
pf_close
=
DateTimeClose
;
p_sys
->
p_sessions
[
i_session_id
-
1
].
p_sys
=
malloc
(
sizeof
(
date_time_t
));
memset
(
p_sys
->
p_sessions
[
i_session_id
-
1
].
p_sys
,
0
,
sizeof
(
date_time_t
)
);
p_sys
->
p_sessions
[
i_session_id
-
1
].
p_sys
=
calloc
(
1
,
sizeof
(
date_time_t
)
);
DateTimeSend
(
p_access
,
i_session_id
);
}
...
...
modules/access_filter/bandwidth.c
View file @
ad08a9c3
...
...
@@ -87,11 +87,10 @@ static int Open (vlc_object_t *obj)
access
->
pf_control
=
Control
;
access
->
info
=
src
->
info
;
access_sys_t
*
p_sys
=
access
->
p_sys
=
malloc
(
sizeof
(
*
p_sys
)
);
if
(
p_sys
==
NULL
)
access_sys_t
*
p_sys
=
access
->
p_sys
=
calloc
(
1
,
sizeof
(
*
p_sys
)
);
if
(
!
p_sys
)
return
VLC_ENOMEM
;
memset
(
p_sys
,
0
,
sizeof
(
*
p_sys
));
p_sys
->
bandwidth
=
var_CreateGetInteger
(
access
,
"access-bandwidth"
);
p_sys
->
last_time
=
mdate
();
...
...
@@ -175,3 +174,4 @@ static int Seek (access_t *access, int64_t offset)
access
->
info
=
src
->
info
;
return
ret
;
}
modules/access_filter/dump.c
View file @
ad08a9c3
...
...
@@ -109,10 +109,9 @@ static int Open (vlc_object_t *obj)
access
->
pf_control
=
Control
;
access
->
info
=
src
->
info
;
access_sys_t
*
p_sys
=
access
->
p_sys
=
malloc
(
sizeof
(
*
p_sys
)
);
if
(
p_sys
==
NULL
)
access_sys_t
*
p_sys
=
access
->
p_sys
=
calloc
(
1
,
sizeof
(
*
p_sys
)
);
if
(
!
p_sys
)
return
VLC_ENOMEM
;
memset
(
p_sys
,
0
,
sizeof
(
*
p_sys
));
# ifndef UNDER_CE
if
((
p_sys
->
stream
=
tmpfile
())
==
NULL
)
...
...
modules/access_output/bonjour.c
View file @
ad08a9c3
...
...
@@ -192,16 +192,12 @@ void *bonjour_start_service( vlc_object_t *p_log, const char *psz_stype,
const
char
*
psz_name
,
int
i_port
,
char
*
psz_txt
)
{
int
err
;
bonjour_t
*
p_sys
;
p_sys
=
(
bonjour_t
*
)
malloc
(
sizeof
(
*
p_sys
)
);
bonjour_t
*
p_sys
=
calloc
(
1
,
sizeof
(
*
p_sys
)
);
if
(
p_sys
==
NULL
)
return
NULL
;
memset
(
p_sys
,
0
,
sizeof
(
*
p_sys
)
);
p_sys
->
p_log
=
p_log
;
p_sys
->
i_port
=
i_port
;
p_sys
->
psz_name
=
avahi_strdup
(
psz_name
);
p_sys
->
psz_stype
=
avahi_strdup
(
psz_stype
);
...
...
modules/audio_output/pulse.c
View file @
ad08a9c3
...
...
@@ -118,10 +118,9 @@ static int Open ( vlc_object_t *p_this )
struct
pa_channel_map
map
;
/* Allocate structures */
p_aout
->
output
.
p_sys
=
p_sys
=
malloc
(
sizeof
(
aout_sys_t
)
);
p_aout
->
output
.
p_sys
=
p_sys
=
calloc
(
1
,
sizeof
(
aout_sys_t
)
);
if
(
p_sys
==
NULL
)
return
VLC_ENOMEM
;
memset
(
p_sys
,
0
,
sizeof
(
aout_sys_t
)
);
PULSE_DEBUG
(
"Pulse start initialization"
);
...
...
modules/codec/avcodec/encoder.c
View file @
ad08a9c3
...
...
@@ -263,9 +263,8 @@ int OpenEncoder( vlc_object_t *p_this )
}
/* Allocate the memory needed to store the encoder's structure */
if
(
(
p_sys
=
(
encoder_sys_t
*
)
malloc
(
sizeof
(
encoder_sys_t
)
)
)
==
NULL
)
if
(
(
p_sys
=
calloc
(
1
,
sizeof
(
encoder_sys_t
)
)
)
==
NULL
)
return
VLC_ENOMEM
;
memset
(
p_sys
,
0
,
sizeof
(
encoder_sys_t
)
);
p_enc
->
p_sys
=
p_sys
;
p_sys
->
p_codec
=
p_codec
;
...
...
modules/codec/avcodec/video.c
View file @
ad08a9c3
...
...
@@ -183,12 +183,8 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
vlc_value_t
val
;
/* Allocate the memory needed to store the decoder's structure */
if
(
(
p_dec
->
p_sys
=
p_sys
=
(
decoder_sys_t
*
)
malloc
(
sizeof
(
decoder_sys_t
))
)
==
NULL
)
{
if
(
(
p_dec
->
p_sys
=
p_sys
=
calloc
(
1
,
sizeof
(
decoder_sys_t
)
)
)
==
NULL
)
return
VLC_ENOMEM
;
}
memset
(
p_sys
,
0
,
sizeof
(
decoder_sys_t
)
);
p_dec
->
p_sys
->
p_context
=
p_context
;
p_dec
->
p_sys
->
p_codec
=
p_codec
;
...
...
modules/codec/cc.c
View file @
ad08a9c3
...
...
@@ -199,14 +199,11 @@ static int Open( vlc_object_t *p_this )
p_dec
->
pf_decode_sub
=
Decode
;
/* Allocate the memory needed to store the decoder's structure */
p_dec
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
*
p_sys
)
);
p_dec
->
p_sys
=
p_sys
=
calloc
(
1
,
sizeof
(
*
p_sys
)
);
if
(
p_sys
==
NULL
)
return
VLC_ENOMEM
;
/* init of p_sys */
memset
(
p_sys
,
0
,
sizeof
(
*
p_sys
)
);
p_sys
->
i_block
=
0
;
p_sys
->
i_field
=
i_field
;
p_sys
->
i_channel
=
i_channel
;
...
...
modules/codec/cdg.c
View file @
ad08a9c3
...
...
@@ -101,14 +101,11 @@ static int Open( vlc_object_t *p_this )
return
VLC_EGENERIC
;
/* Allocate the memory needed to store the decoder's structure */
p_dec
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
decoder_sys_t
)
);
p_dec
->
p_sys
=
p_sys
=
calloc
(
1
,
sizeof
(
decoder_sys_t
)
);
if
(
!
p_sys
)
return
VLC_ENOMEM
;
/* Init */
memset
(
p_sys
,
0
,
sizeof
(
*
p_sys
)
);
p_sys
->
i_offseth
=
0
;
p_sys
->
i_offsetv
=
0
;
p_sys
->
p_screen
=
p_sys
->
screen
;
/* Set output properties
...
...
modules/codec/csri.c
View file @
ad08a9c3
...
...
@@ -120,10 +120,9 @@ static int Create( vlc_object_t *p_this )
p_dec
->
pf_decode_sub
=
DecodeBlock
;
p_dec
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
decoder_sys_t
)
);
p_dec
->
p_sys
=
p_sys
=
calloc
(
1
,
sizeof
(
decoder_sys_t
)
);
if
(
!
p_sys
)
return
VLC_ENOMEM
;
memset
(
&
p_sys
->
fmt_cached
,
0
,
sizeof
(
p_sys
->
fmt_cached
)
);
p_sys
->
p_stream_ext
=
p_stream_ext
;
p_sys
->
pf_push_packet
=
p_stream_ext
->
push_packet
;
...
...
modules/misc/rtsp.c
View file @
ad08a9c3
...
...
@@ -368,14 +368,13 @@ static void Close( vlc_object_t * p_this )
static
vod_media_t
*
MediaNew
(
vod_t
*
p_vod
,
const
char
*
psz_name
,
input_item_t
*
p_item
)
{
vod_sys_t
*
p_sys
=
p_vod
->
p_sys
;
vod_media_t
*
p_media
=
malloc
(
sizeof
(
vod_media_t
)
);
int
i
;
vod_sys_t
*
p_sys
=
p_vod
->
p_sys
;
vod_media_t
*
p_media
=
calloc
(
1
,
sizeof
(
vod_media_t
)
);
if
(
!
p_media
)
return
NULL
;
memset
(
p_media
,
0
,
sizeof
(
vod_media_t
)
);
p_media
->
id
=
p_sys
->
i_media_id
++
;
TAB_INIT
(
p_media
->
i_es
,
p_media
->
es
);
p_media
->
psz_mux
=
NULL
;
...
...
@@ -498,11 +497,10 @@ static void MediaDel( vod_t *p_vod, vod_media_t *p_media )
static
int
MediaAddES
(
vod_t
*
p_vod
,
vod_media_t
*
p_media
,
es_format_t
*
p_fmt
)
{
media_es_t
*
p_es
=
malloc
(
sizeof
(
media_es_t
)
);
char
*
psz_urlc
;
if
(
!
p_es
)
return
VLC_ENOMEM
;
memset
(
p_es
,
0
,
sizeof
(
media_es_t
)
)
;
media_es_t
*
p_es
=
calloc
(
1
,
sizeof
(
media_es_t
)
);
if
(
!
p_es
)
return
VLC_ENOMEM
;
free
(
p_media
->
psz_mux
);
p_media
->
psz_mux
=
NULL
;
...
...
@@ -896,10 +894,10 @@ static void* CommandThread( vlc_object_t *p_this )
****************************************************************************/
static
rtsp_client_t
*
RtspClientNew
(
vod_media_t
*
p_media
,
char
*
psz_session
)
{
rtsp_client_t
*
p_rtsp
=
malloc
(
sizeof
(
rtsp_client_t
)
);
rtsp_client_t
*
p_rtsp
=
calloc
(
1
,
sizeof
(
rtsp_client_t
)
);
if
(
!
p_rtsp
)
return
NULL
;
memset
(
p_rtsp
,
0
,
sizeof
(
rtsp_client_t
)
)
;
if
(
!
p_rtsp
)
return
NULL
;
p_rtsp
->
es
=
0
;
p_rtsp
->
psz_session
=
psz_session
;
...
...
modules/mux/mpeg/csa.c
View file @
ad08a9c3
...
...
@@ -66,10 +66,7 @@ static void csa_BlockCypher( uint8_t kk[57], uint8_t bd[8], uint8_t ib[8] );
*****************************************************************************/
csa_t
*
csa_New
(
void
)
{
csa_t
*
c
=
malloc
(
sizeof
(
csa_t
)
);
memset
(
c
,
0
,
sizeof
(
csa_t
)
);
return
c
;
return
calloc
(
1
,
sizeof
(
csa_t
)
);
}
/*****************************************************************************
...
...
modules/mux/ogg.c
View file @
ad08a9c3
...
...
@@ -354,13 +354,12 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
case
VLC_FOURCC
(
'W'
,
'M'
,
'V'
,
'2'
):
case
VLC_FOURCC
(
'W'
,
'M'
,
'V'
,
'3'
):
case
VLC_FOURCC
(
'S'
,
'N'
,
'O'
,
'W'
):
p_stream
->
p_oggds_header
=
malloc
(
sizeof
(
oggds_header_t
)
);
p_stream
->
p_oggds_header
=
calloc
(
1
,
sizeof
(
oggds_header_t
)
);
if
(
!
p_stream
->
p_oggds_header
)
{
free
(
p_stream
);
return
VLC_ENOMEM
;
}
memset
(
p_stream
->
p_oggds_header
,
0
,
sizeof
(
oggds_header_t
)
);
p_stream
->
p_oggds_header
->
i_packet_type
=
PACKET_TYPE_HEADER
;
memcpy
(
p_stream
->
p_oggds_header
->
stream_type
,
"video"
,
5
);
...
...
@@ -476,13 +475,12 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
switch
(
p_stream
->
i_fourcc
)
{
case
VLC_FOURCC
(
's'
,
'u'
,
'b'
,
't'
):
p_stream
->
p_oggds_header
=
malloc
(
sizeof
(
oggds_header_t
)
);
p_stream
->
p_oggds_header
=
calloc
(
1
,
sizeof
(
oggds_header_t
)
);
if
(
!
p_stream
->
p_oggds_header
)
{
free
(
p_stream
);
return
VLC_ENOMEM
;
}
memset
(
p_stream
->
p_oggds_header
,
0
,
sizeof
(
oggds_header_t
)
);
p_stream
->
p_oggds_header
->
i_packet_type
=
PACKET_TYPE_HEADER
;
memcpy
(
p_stream
->
p_oggds_header
->
stream_type
,
"text"
,
4
);
...
...
modules/stream_out/transcode.c
View file @
ad08a9c3
...
...
@@ -693,10 +693,9 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
sout_stream_sys_t
*
p_sys
=
p_stream
->
p_sys
;
sout_stream_id_t
*
id
;
id
=
malloc
(
sizeof
(
sout_stream_id_t
)
);
id
=
calloc
(
1
,
sizeof
(
sout_stream_id_t
)
);
if
(
!
id
)
goto
error
;
memset
(
id
,
0
,
sizeof
(
sout_stream_id_t
)
);
id
->
id
=
NULL
;
id
->
p_decoder
=
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment