Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
cc988dd7
Commit
cc988dd7
authored
16 years ago
by
Michael Niedermayer
Browse files
Options
Downloads
Patches
Plain Diff
Fix memleak of header in error returns.
Originally committed as revision 16831 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
59afda9f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavformat/4xm.c
+12
-4
12 additions, 4 deletions
libavformat/4xm.c
with
12 additions
and
4 deletions
libavformat/4xm.c
+
12
−
4
View file @
cc988dd7
...
@@ -121,8 +121,10 @@ static int fourxm_read_header(AVFormatContext *s,
...
@@ -121,8 +121,10 @@ static int fourxm_read_header(AVFormatContext *s,
header
=
av_malloc
(
header_size
);
header
=
av_malloc
(
header_size
);
if
(
!
header
)
if
(
!
header
)
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
if
(
get_buffer
(
pb
,
header
,
header_size
)
!=
header_size
)
if
(
get_buffer
(
pb
,
header
,
header_size
)
!=
header_size
){
av_free
(
header
);
return
AVERROR
(
EIO
);
return
AVERROR
(
EIO
);
}
/* take the lazy approach and search for any and all vtrk and strk chunks */
/* take the lazy approach and search for any and all vtrk and strk chunks */
for
(
i
=
0
;
i
<
header_size
-
8
;
i
++
)
{
for
(
i
=
0
;
i
<
header_size
-
8
;
i
++
)
{
...
@@ -142,8 +144,10 @@ static int fourxm_read_header(AVFormatContext *s,
...
@@ -142,8 +144,10 @@ static int fourxm_read_header(AVFormatContext *s,
/* allocate a new AVStream */
/* allocate a new AVStream */
st
=
av_new_stream
(
s
,
0
);
st
=
av_new_stream
(
s
,
0
);
if
(
!
st
)
if
(
!
st
){
av_free
(
header
);
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
}
av_set_pts_info
(
st
,
60
,
1
,
fourxm
->
fps
);
av_set_pts_info
(
st
,
60
,
1
,
fourxm
->
fps
);
fourxm
->
video_stream_index
=
st
->
index
;
fourxm
->
video_stream_index
=
st
->
index
;
...
@@ -166,8 +170,10 @@ static int fourxm_read_header(AVFormatContext *s,
...
@@ -166,8 +170,10 @@ static int fourxm_read_header(AVFormatContext *s,
current_track
=
AV_RL32
(
&
header
[
i
+
8
]);
current_track
=
AV_RL32
(
&
header
[
i
+
8
]);
if
(
current_track
+
1
>
fourxm
->
track_count
)
{
if
(
current_track
+
1
>
fourxm
->
track_count
)
{
fourxm
->
track_count
=
current_track
+
1
;
fourxm
->
track_count
=
current_track
+
1
;
if
((
unsigned
)
fourxm
->
track_count
>=
UINT_MAX
/
sizeof
(
AudioTrack
))
if
((
unsigned
)
fourxm
->
track_count
>=
UINT_MAX
/
sizeof
(
AudioTrack
)){
av_free
(
header
);
return
-
1
;
return
-
1
;
}
fourxm
->
tracks
=
av_realloc
(
fourxm
->
tracks
,
fourxm
->
tracks
=
av_realloc
(
fourxm
->
tracks
,
fourxm
->
track_count
*
sizeof
(
AudioTrack
));
fourxm
->
track_count
*
sizeof
(
AudioTrack
));
if
(
!
fourxm
->
tracks
)
{
if
(
!
fourxm
->
tracks
)
{
...
@@ -183,8 +189,10 @@ static int fourxm_read_header(AVFormatContext *s,
...
@@ -183,8 +189,10 @@ static int fourxm_read_header(AVFormatContext *s,
/* allocate a new AVStream */
/* allocate a new AVStream */
st
=
av_new_stream
(
s
,
current_track
);
st
=
av_new_stream
(
s
,
current_track
);
if
(
!
st
)
if
(
!
st
){
av_free
(
header
);
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
}
av_set_pts_info
(
st
,
60
,
1
,
fourxm
->
tracks
[
current_track
].
sample_rate
);
av_set_pts_info
(
st
,
60
,
1
,
fourxm
->
tracks
[
current_track
].
sample_rate
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment