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
8cb7b7b4
Commit
8cb7b7b4
authored
Nov 02, 2014
by
Martin Storsjö
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
movenc: Avoid leaking locally allocated data when returning on errors
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
95a449d3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
movenc.c
libavformat/movenc.c
+12
-6
No files found.
libavformat/movenc.c
View file @
8cb7b7b4
...
...
@@ -3065,7 +3065,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
MOVTrack
*
trk
=
&
mov
->
tracks
[
pkt
->
stream_index
];
AVCodecContext
*
enc
=
trk
->
enc
;
unsigned
int
samples_in_chunk
=
0
;
int
size
=
pkt
->
size
;
int
size
=
pkt
->
size
,
ret
=
0
;
uint8_t
*
reformatted_data
=
NULL
;
if
(
mov
->
flags
&
FF_MOV_FLAG_FRAGMENT
)
{
...
...
@@ -3139,16 +3139,20 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
/* copy frame to create needed atoms */
trk
->
vos_len
=
size
;
trk
->
vos_data
=
av_malloc
(
size
);
if
(
!
trk
->
vos_data
)
return
AVERROR
(
ENOMEM
);
if
(
!
trk
->
vos_data
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
err
;
}
memcpy
(
trk
->
vos_data
,
pkt
->
data
,
size
);
}
if
(
trk
->
entry
>=
trk
->
cluster_capacity
)
{
unsigned
new_capacity
=
2
*
(
trk
->
entry
+
MOV_INDEX_CLUSTER_SIZE
);
if
(
av_reallocp_array
(
&
trk
->
cluster
,
new_capacity
,
sizeof
(
*
trk
->
cluster
)))
return
AVERROR
(
ENOMEM
);
sizeof
(
*
trk
->
cluster
)))
{
ret
=
AVERROR
(
ENOMEM
);
goto
err
;
}
trk
->
cluster_capacity
=
new_capacity
;
}
...
...
@@ -3212,8 +3216,10 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
if
(
trk
->
hint_track
>=
0
&&
trk
->
hint_track
<
mov
->
nb_streams
)
ff_mov_add_hinted_packet
(
s
,
pkt
,
trk
->
hint_track
,
trk
->
entry
,
reformatted_data
,
size
);
err:
av_free
(
reformatted_data
);
return
0
;
return
ret
;
}
static
int
mov_write_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
...
...
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