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
89b51b57
Commit
89b51b57
authored
12 years ago
by
Luca Barbato
Browse files
Options
Downloads
Patches
Plain Diff
oggdec: free the ogg streams on read_header failure
Plug an annoying memory leak on broken files.
parent
a0c5917f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavformat/oggdec.c
+16
-14
16 additions, 14 deletions
libavformat/oggdec.c
with
16 additions
and
14 deletions
libavformat/oggdec.c
+
16
−
14
View file @
89b51b57
...
@@ -526,6 +526,19 @@ static int ogg_get_length(AVFormatContext *s)
...
@@ -526,6 +526,19 @@ static int ogg_get_length(AVFormatContext *s)
return
0
;
return
0
;
}
}
static
int
ogg_read_close
(
AVFormatContext
*
s
)
{
struct
ogg
*
ogg
=
s
->
priv_data
;
int
i
;
for
(
i
=
0
;
i
<
ogg
->
nstreams
;
i
++
)
{
av_free
(
ogg
->
streams
[
i
].
buf
);
av_free
(
ogg
->
streams
[
i
].
private
);
}
av_free
(
ogg
->
streams
);
return
0
;
}
static
int
ogg_read_header
(
AVFormatContext
*
s
)
static
int
ogg_read_header
(
AVFormatContext
*
s
)
{
{
struct
ogg
*
ogg
=
s
->
priv_data
;
struct
ogg
*
ogg
=
s
->
priv_data
;
...
@@ -533,8 +546,10 @@ static int ogg_read_header(AVFormatContext *s)
...
@@ -533,8 +546,10 @@ static int ogg_read_header(AVFormatContext *s)
ogg
->
curidx
=
-
1
;
ogg
->
curidx
=
-
1
;
//linear headers seek from start
//linear headers seek from start
ret
=
ogg_get_headers
(
s
);
ret
=
ogg_get_headers
(
s
);
if
(
ret
<
0
)
if
(
ret
<
0
)
{
ogg_read_close
(
s
);
return
ret
;
return
ret
;
}
for
(
i
=
0
;
i
<
ogg
->
nstreams
;
i
++
)
for
(
i
=
0
;
i
<
ogg
->
nstreams
;
i
++
)
if
(
ogg
->
streams
[
i
].
header
<
0
)
if
(
ogg
->
streams
[
i
].
header
<
0
)
...
@@ -619,19 +634,6 @@ retry:
...
@@ -619,19 +634,6 @@ retry:
return
psize
;
return
psize
;
}
}
static
int
ogg_read_close
(
AVFormatContext
*
s
)
{
struct
ogg
*
ogg
=
s
->
priv_data
;
int
i
;
for
(
i
=
0
;
i
<
ogg
->
nstreams
;
i
++
)
{
av_free
(
ogg
->
streams
[
i
].
buf
);
av_free
(
ogg
->
streams
[
i
].
private
);
}
av_free
(
ogg
->
streams
);
return
0
;
}
static
int64_t
ogg_read_timestamp
(
AVFormatContext
*
s
,
int
stream_index
,
static
int64_t
ogg_read_timestamp
(
AVFormatContext
*
s
,
int
stream_index
,
int64_t
*
pos_arg
,
int64_t
pos_limit
)
int64_t
*
pos_arg
,
int64_t
pos_limit
)
{
{
...
...
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