Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libopusenc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
libopusenc
Commits
3e73d2ee
Unverified
Commit
3e73d2ee
authored
Jan 14, 2018
by
Mark Harris
Committed by
Jean-Marc Valin
Jan 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix allocation failure cleanup
Signed-off-by:
Jean-Marc Valin
<
jmvalin@jmvalin.ca
>
parent
902d9a07
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
10 deletions
+16
-10
src/opus_header.c
src/opus_header.c
+8
-5
src/opusenc.c
src/opusenc.c
+8
-5
No files found.
src/opus_header.c
View file @
3e73d2ee
...
...
@@ -191,11 +191,14 @@ void _ope_comment_init(char **comments, int* length, const char *vendor_string)
int
user_comment_list_length
=
0
;
int
len
=
8
+
4
+
vendor_length
+
4
;
char
*
p
=
(
char
*
)
malloc
(
len
);
if
(
p
==
NULL
)
return
;
memcpy
(
p
,
"OpusTags"
,
8
);
writeint
(
p
,
8
,
vendor_length
);
memcpy
(
p
+
12
,
vendor_string
,
vendor_length
);
writeint
(
p
,
12
+
vendor_length
,
user_comment_list_length
);
if
(
p
==
NULL
)
{
len
=
0
;
}
else
{
memcpy
(
p
,
"OpusTags"
,
8
);
writeint
(
p
,
8
,
vendor_length
);
memcpy
(
p
+
12
,
vendor_string
,
vendor_length
);
writeint
(
p
,
12
+
vendor_length
,
user_comment_list_length
);
}
*
length
=
len
;
*
comments
=
p
;
}
...
...
src/opusenc.c
View file @
3e73d2ee
...
...
@@ -231,8 +231,13 @@ OggOpusEnc *ope_encoder_create_file(const char *path, OggOpusComments *comments,
OggOpusEnc
*
enc
;
struct
StdioObject
*
obj
;
obj
=
malloc
(
sizeof
(
*
obj
));
if
(
obj
==
NULL
)
{
if
(
error
)
*
error
=
OPE_ALLOC_FAIL
;
return
NULL
;
}
enc
=
ope_encoder_create_callbacks
(
&
stdio_callbacks
,
obj
,
comments
,
rate
,
channels
,
family
,
error
);
if
(
enc
==
NULL
||
(
error
&&
*
error
))
{
free
(
obj
);
return
NULL
;
}
obj
->
file
=
_ope_fopen
(
path
,
"wb"
);
...
...
@@ -291,9 +296,9 @@ OggOpusEnc *ope_encoder_create_callbacks(const OpusEncCallbacks *callbacks, void
}
if
(
(
enc
=
malloc
(
sizeof
(
*
enc
)))
==
NULL
)
goto
fail
;
enc
->
streams
=
NULL
;
enc
->
buffer
=
NULL
;
enc
->
lpc_buffer
=
NULL
;
if
(
(
enc
->
streams
=
stream_create
(
comments
))
==
NULL
)
goto
fail
;
enc
->
streams
->
next
=
NULL
;
enc
->
last_stream
=
enc
->
streams
;
enc
->
oggp
=
NULL
;
enc
->
unrecoverable
=
0
;
...
...
@@ -334,8 +339,6 @@ OggOpusEnc *ope_encoder_create_callbacks(const OpusEncCallbacks *callbacks, void
/* Allocate an extra LPC_PADDING samples so we can do the padding in-place. */
if
(
(
enc
->
lpc_buffer
=
malloc
(
sizeof
(
*
enc
->
lpc_buffer
)
*
(
LPC_INPUT
+
LPC_PADDING
)
*
channels
))
==
NULL
)
goto
fail
;
memset
(
enc
->
lpc_buffer
,
0
,
sizeof
(
*
enc
->
lpc_buffer
)
*
LPC_INPUT
*
channels
);
}
else
{
enc
->
lpc_buffer
=
NULL
;
}
enc
->
buffer_start
=
enc
->
buffer_end
=
0
;
enc
->
st
=
st
;
...
...
@@ -348,10 +351,10 @@ OggOpusEnc *ope_encoder_create_callbacks(const OpusEncCallbacks *callbacks, void
return
enc
;
fail:
if
(
enc
)
{
free
(
enc
);
if
(
enc
->
buffer
)
free
(
enc
->
buffer
);
if
(
enc
->
streams
)
stream_destroy
(
enc
->
streams
);
if
(
enc
->
lpc_buffer
)
free
(
enc
->
lpc_buffer
);
free
(
enc
);
}
if
(
st
)
{
opus_multistream_encoder_destroy
(
st
);
...
...
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