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
2bbad1f9
Commit
2bbad1f9
authored
Aug 26, 2013
by
Martin Storsjö
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
movenc: Properly free allocated data on failures in mov_write_header
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
3559fb97
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
15 deletions
+26
-15
movenc.c
libavformat/movenc.c
+26
-15
No files found.
libavformat/movenc.c
View file @
2bbad1f9
...
...
@@ -3101,6 +3101,30 @@ static void enable_tracks(AVFormatContext *s)
}
}
static
void
mov_free
(
AVFormatContext
*
s
)
{
MOVMuxContext
*
mov
=
s
->
priv_data
;
int
i
;
if
(
mov
->
chapter_track
)
{
if
(
mov
->
tracks
[
mov
->
chapter_track
].
enc
)
av_free
(
mov
->
tracks
[
mov
->
chapter_track
].
enc
->
extradata
);
av_freep
(
&
mov
->
tracks
[
mov
->
chapter_track
].
enc
);
}
for
(
i
=
0
;
i
<
mov
->
nb_streams
;
i
++
)
{
if
(
mov
->
tracks
[
i
].
tag
==
MKTAG
(
'r'
,
't'
,
'p'
,
' '
))
ff_mov_close_hinting
(
&
mov
->
tracks
[
i
]);
av_freep
(
&
mov
->
tracks
[
i
].
cluster
);
av_freep
(
&
mov
->
tracks
[
i
].
frag_info
);
if
(
mov
->
tracks
[
i
].
vos_len
)
av_free
(
mov
->
tracks
[
i
].
vos_data
);
}
av_freep
(
&
mov
->
tracks
);
}
static
int
mov_write_header
(
AVFormatContext
*
s
)
{
AVIOContext
*
pb
=
s
->
pb
;
...
...
@@ -3305,7 +3329,7 @@ static int mov_write_header(AVFormatContext *s)
return
0
;
error:
av_freep
(
&
mov
->
track
s
);
mov_free
(
s
);
return
-
1
;
}
...
...
@@ -3469,15 +3493,7 @@ static int mov_write_trailer(AVFormatContext *s)
mov_write_mfra_tag
(
pb
,
mov
);
}
if
(
mov
->
chapter_track
)
{
if
(
mov
->
tracks
[
mov
->
chapter_track
].
enc
)
av_free
(
mov
->
tracks
[
mov
->
chapter_track
].
enc
->
extradata
);
av_freep
(
&
mov
->
tracks
[
mov
->
chapter_track
].
enc
);
}
for
(
i
=
0
;
i
<
mov
->
nb_streams
;
i
++
)
{
if
(
mov
->
tracks
[
i
].
tag
==
MKTAG
(
'r'
,
't'
,
'p'
,
' '
))
ff_mov_close_hinting
(
&
mov
->
tracks
[
i
]);
if
(
mov
->
flags
&
FF_MOV_FLAG_FRAGMENT
&&
mov
->
tracks
[
i
].
vc1_info
.
struct_offset
&&
s
->
pb
->
seekable
)
{
int64_t
off
=
avio_tell
(
pb
);
...
...
@@ -3488,14 +3504,9 @@ static int mov_write_trailer(AVFormatContext *s)
avio_seek
(
pb
,
off
,
SEEK_SET
);
}
}
av_freep
(
&
mov
->
tracks
[
i
].
cluster
);
av_freep
(
&
mov
->
tracks
[
i
].
frag_info
);
if
(
mov
->
tracks
[
i
].
vos_len
)
av_free
(
mov
->
tracks
[
i
].
vos_data
);
}
av_freep
(
&
mov
->
track
s
);
mov_free
(
s
);
return
res
;
}
...
...
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