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
8e2555d3
Commit
8e2555d3
authored
Feb 20, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
g722enc: check for trellis data allocation error
parent
ca300d93
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
12 deletions
+20
-12
g722enc.c
libavcodec/g722enc.c
+20
-12
No files found.
libavcodec/g722enc.c
View file @
8e2555d3
...
...
@@ -41,9 +41,22 @@
#define MIN_TRELLIS 0
#define MAX_TRELLIS 16
static
av_cold
int
g722_encode_close
(
AVCodecContext
*
avctx
)
{
G722Context
*
c
=
avctx
->
priv_data
;
int
i
;
for
(
i
=
0
;
i
<
2
;
i
++
)
{
av_freep
(
&
c
->
paths
[
i
]);
av_freep
(
&
c
->
node_buf
[
i
]);
av_freep
(
&
c
->
nodep_buf
[
i
]);
}
return
0
;
}
static
av_cold
int
g722_encode_init
(
AVCodecContext
*
avctx
)
{
G722Context
*
c
=
avctx
->
priv_data
;
int
ret
;
if
(
avctx
->
channels
!=
1
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Only mono tracks are allowed.
\n
"
);
...
...
@@ -62,6 +75,10 @@ static av_cold int g722_encode_init(AVCodecContext * avctx)
c
->
paths
[
i
]
=
av_mallocz
(
max_paths
*
sizeof
(
**
c
->
paths
));
c
->
node_buf
[
i
]
=
av_mallocz
(
2
*
frontier
*
sizeof
(
**
c
->
node_buf
));
c
->
nodep_buf
[
i
]
=
av_mallocz
(
2
*
frontier
*
sizeof
(
**
c
->
nodep_buf
));
if
(
!
c
->
paths
[
i
]
||
!
c
->
node_buf
[
i
]
||
!
c
->
nodep_buf
[
i
])
{
ret
=
AVERROR
(
ENOMEM
);
goto
error
;
}
}
}
...
...
@@ -100,18 +117,9 @@ static av_cold int g722_encode_init(AVCodecContext * avctx)
}
return
0
;
}
static
av_cold
int
g722_encode_close
(
AVCodecContext
*
avctx
)
{
G722Context
*
c
=
avctx
->
priv_data
;
int
i
;
for
(
i
=
0
;
i
<
2
;
i
++
)
{
av_freep
(
&
c
->
paths
[
i
]);
av_freep
(
&
c
->
node_buf
[
i
]);
av_freep
(
&
c
->
nodep_buf
[
i
]);
}
return
0
;
error:
g722_encode_close
(
avctx
);
return
ret
;
}
static
const
int16_t
low_quant
[
33
]
=
{
...
...
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