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
89b51b57
Commit
89b51b57
authored
Jan 04, 2013
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oggdec: free the ogg streams on read_header failure
Plug an annoying memory leak on broken files.
parent
a0c5917f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
+16
-14
oggdec.c
libavformat/oggdec.c
+16
-14
No files found.
libavformat/oggdec.c
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
)
{
{
...
...
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