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
de1568a4
Commit
de1568a4
authored
Mar 20, 2013
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/concatdec: fix possible leak in case of malloc failure.
Fix CID 747737.
parent
5eb273b2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
concatdec.c
libavformat/concatdec.c
+11
-5
No files found.
libavformat/concatdec.c
View file @
de1568a4
...
...
@@ -82,25 +82,26 @@ static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile,
{
ConcatContext
*
cat
=
avf
->
priv_data
;
ConcatFile
*
file
;
char
*
url
;
char
*
url
=
NULL
;
size_t
url_len
;
int
ret
;
if
(
cat
->
safe
>
0
&&
!
safe_filename
(
filename
))
{
av_log
(
avf
,
AV_LOG_ERROR
,
"Unsafe file name '%s'
\n
"
,
filename
);
return
AVERROR
(
EPERM
);
FAIL
(
AVERROR
(
EPERM
)
);
}
url_len
=
strlen
(
avf
->
filename
)
+
strlen
(
filename
)
+
16
;
if
(
!
(
url
=
av_malloc
(
url_len
)))
return
AVERROR
(
ENOMEM
);
FAIL
(
AVERROR
(
ENOMEM
)
);
ff_make_absolute_url
(
url
,
url_len
,
avf
->
filename
,
filename
);
av_free
(
filename
);
av_free
p
(
&
filename
);
if
(
cat
->
nb_files
>=
*
nb_files_alloc
)
{
size_t
n
=
FFMAX
(
*
nb_files_alloc
*
2
,
16
);
ConcatFile
*
new_files
;
if
(
n
<=
cat
->
nb_files
||
n
>
SIZE_MAX
/
sizeof
(
*
cat
->
files
)
||
!
(
new_files
=
av_realloc
(
cat
->
files
,
n
*
sizeof
(
*
cat
->
files
))))
return
AVERROR
(
ENOMEM
);
FAIL
(
AVERROR
(
ENOMEM
)
);
cat
->
files
=
new_files
;
*
nb_files_alloc
=
n
;
}
...
...
@@ -114,6 +115,11 @@ static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile,
file
->
duration
=
AV_NOPTS_VALUE
;
return
0
;
fail:
av_free
(
url
);
av_free
(
filename
);
return
ret
;
}
static
int
open_file
(
AVFormatContext
*
avf
,
unsigned
fileno
)
...
...
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