Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
73953df7
Commit
73953df7
authored
Jun 19, 2014
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace av_malloc() and memset(0) by av_mallocz()
parent
f83896ab
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
9 deletions
+4
-9
matroskadec.c
libavformat/matroskadec.c
+1
-3
rmdec.c
libavformat/rmdec.c
+1
-2
utils.c
libavformat/utils.c
+2
-4
No files found.
libavformat/matroskadec.c
View file @
73953df7
...
...
@@ -746,11 +746,9 @@ static int ebml_read_ascii(AVIOContext *pb, int size, char **str)
static
int
ebml_read_binary
(
AVIOContext
*
pb
,
int
length
,
EbmlBin
*
bin
)
{
av_free
(
bin
->
data
);
if
(
!
(
bin
->
data
=
av_malloc
(
length
+
FF_INPUT_BUFFER_PADDING_SIZE
)))
if
(
!
(
bin
->
data
=
av_malloc
z
(
length
+
FF_INPUT_BUFFER_PADDING_SIZE
)))
return
AVERROR
(
ENOMEM
);
memset
(
bin
->
data
+
length
,
0
,
FF_INPUT_BUFFER_PADDING_SIZE
);
bin
->
size
=
length
;
bin
->
pos
=
avio_tell
(
pb
);
if
(
avio_read
(
pb
,
bin
->
data
,
length
)
!=
length
)
{
...
...
libavformat/rmdec.c
View file @
73953df7
...
...
@@ -86,11 +86,10 @@ static int rm_read_extradata(AVIOContext *pb, AVCodecContext *avctx, unsigned si
{
if
(
size
>=
1
<<
24
)
return
-
1
;
avctx
->
extradata
=
av_malloc
(
size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
avctx
->
extradata
=
av_malloc
z
(
size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!
avctx
->
extradata
)
return
AVERROR
(
ENOMEM
);
avctx
->
extradata_size
=
avio_read
(
pb
,
avctx
->
extradata
,
size
);
memset
(
avctx
->
extradata
+
avctx
->
extradata_size
,
0
,
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
avctx
->
extradata_size
!=
size
)
return
AVERROR
(
EIO
);
return
0
;
...
...
libavformat/utils.c
View file @
73953df7
...
...
@@ -2381,14 +2381,12 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
int
i
=
st
->
parser
->
parser
->
split
(
st
->
codec
,
pkt
->
data
,
pkt
->
size
);
if
(
i
>
0
&&
i
<
FF_MAX_EXTRADATA_SIZE
)
{
st
->
codec
->
extradata_size
=
i
;
st
->
codec
->
extradata
=
av_malloc
(
st
->
codec
->
extradata_size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
st
->
codec
->
extradata
=
av_malloc
z
(
st
->
codec
->
extradata_size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!
st
->
codec
->
extradata
)
return
AVERROR
(
ENOMEM
);
memcpy
(
st
->
codec
->
extradata
,
pkt
->
data
,
st
->
codec
->
extradata_size
);
memset
(
st
->
codec
->
extradata
+
i
,
0
,
FF_INPUT_BUFFER_PADDING_SIZE
);
}
}
...
...
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