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
0699dbb8
Commit
0699dbb8
authored
May 04, 2011
by
Ronald S. Bultje
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter: check malloc return values.
parent
d969e93a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
avfilter.c
libavfilter/avfilter.c
+25
-1
No files found.
libavfilter/avfilter.c
View file @
0699dbb8
...
...
@@ -583,29 +583,53 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in
return
AVERROR
(
EINVAL
);
ret
=
av_mallocz
(
sizeof
(
AVFilterContext
));
if
(
!
ret
)
return
AVERROR
(
ENOMEM
);
ret
->
av_class
=
&
avfilter_class
;
ret
->
filter
=
filter
;
ret
->
name
=
inst_name
?
av_strdup
(
inst_name
)
:
NULL
;
if
(
filter
->
priv_size
)
if
(
filter
->
priv_size
)
{
ret
->
priv
=
av_mallocz
(
filter
->
priv_size
);
if
(
!
ret
->
priv
)
goto
err
;
}
ret
->
input_count
=
pad_count
(
filter
->
inputs
);
if
(
ret
->
input_count
)
{
ret
->
input_pads
=
av_malloc
(
sizeof
(
AVFilterPad
)
*
ret
->
input_count
);
if
(
!
ret
->
input_pads
)
goto
err
;
memcpy
(
ret
->
input_pads
,
filter
->
inputs
,
sizeof
(
AVFilterPad
)
*
ret
->
input_count
);
ret
->
inputs
=
av_mallocz
(
sizeof
(
AVFilterLink
*
)
*
ret
->
input_count
);
if
(
!
ret
->
inputs
)
goto
err
;
}
ret
->
output_count
=
pad_count
(
filter
->
outputs
);
if
(
ret
->
output_count
)
{
ret
->
output_pads
=
av_malloc
(
sizeof
(
AVFilterPad
)
*
ret
->
output_count
);
if
(
!
ret
->
output_pads
)
goto
err
;
memcpy
(
ret
->
output_pads
,
filter
->
outputs
,
sizeof
(
AVFilterPad
)
*
ret
->
output_count
);
ret
->
outputs
=
av_mallocz
(
sizeof
(
AVFilterLink
*
)
*
ret
->
output_count
);
if
(
!
ret
->
outputs
)
goto
err
;
}
*
filter_ctx
=
ret
;
return
0
;
err:
av_freep
(
&
ret
->
inputs
);
av_freep
(
&
ret
->
input_pads
);
ret
->
input_count
=
0
;
av_freep
(
&
ret
->
outputs
);
av_freep
(
&
ret
->
output_pads
);
ret
->
output_count
=
0
;
av_freep
(
&
ret
->
priv
);
av_free
(
ret
);
return
AVERROR
(
ENOMEM
);
}
void
avfilter_free
(
AVFilterContext
*
filter
)
...
...
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