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
23a8b4dd
Commit
23a8b4dd
authored
Oct 29, 2011
by
Ronald S. Bultje
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter: don't abort() on zero-size allocations.
parent
ea2bb12e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
formats.c
libavfilter/formats.c
+6
-3
No files found.
libavfilter/formats.c
View file @
23a8b4dd
...
...
@@ -43,19 +43,21 @@ static void merge_ref(AVFilterFormats *ret, AVFilterFormats *a)
AVFilterFormats
*
avfilter_merge_formats
(
AVFilterFormats
*
a
,
AVFilterFormats
*
b
)
{
AVFilterFormats
*
ret
;
unsigned
i
,
j
,
k
=
0
;
unsigned
i
,
j
,
k
=
0
,
m_count
;
ret
=
av_mallocz
(
sizeof
(
AVFilterFormats
));
/* merge list of formats */
ret
->
formats
=
av_malloc
(
sizeof
(
*
ret
->
formats
)
*
FFMIN
(
a
->
format_count
,
b
->
format_count
));
m_count
=
FFMIN
(
a
->
format_count
,
b
->
format_count
);
if
(
m_count
)
{
ret
->
formats
=
av_malloc
(
sizeof
(
*
ret
->
formats
)
*
m_count
);
for
(
i
=
0
;
i
<
a
->
format_count
;
i
++
)
for
(
j
=
0
;
j
<
b
->
format_count
;
j
++
)
if
(
a
->
formats
[
i
]
==
b
->
formats
[
j
])
ret
->
formats
[
k
++
]
=
a
->
formats
[
i
];
ret
->
format_count
=
k
;
}
/* check that there was at least one common format */
if
(
!
ret
->
format_count
)
{
av_free
(
ret
->
formats
);
...
...
@@ -91,6 +93,7 @@ AVFilterFormats *avfilter_make_format_list(const int *fmts)
;
formats
=
av_mallocz
(
sizeof
(
AVFilterFormats
));
if
(
count
)
formats
->
formats
=
av_malloc
(
sizeof
(
*
formats
->
formats
)
*
count
);
formats
->
format_count
=
count
;
memcpy
(
formats
->
formats
,
fmts
,
sizeof
(
*
formats
->
formats
)
*
count
);
...
...
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