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
S
SpeexDSP
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
SpeexDSP
Commits
8c2981fa
Commit
8c2981fa
authored
Apr 19, 2016
by
Jean-Yves Avenard
Committed by
Tristan Matthews
May 10, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle memory allocation failures during initialization
Signed-off-by:
Tristan Matthews
<
tmatth@videolan.org
>
parent
13d02a0f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
3 deletions
+18
-3
libspeexdsp/resample.c
libspeexdsp/resample.c
+18
-3
No files found.
libspeexdsp/resample.c
View file @
8c2981fa
...
...
@@ -792,6 +792,12 @@ EXPORT SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels,
return
NULL
;
}
st
=
(
SpeexResamplerState
*
)
speex_alloc
(
sizeof
(
SpeexResamplerState
));
if
(
!
st
)
{
if
(
err
)
*
err
=
RESAMPLER_ERR_ALLOC_FAILED
;
return
NULL
;
}
st
->
initialised
=
0
;
st
->
started
=
0
;
st
->
in_rate
=
0
;
...
...
@@ -813,9 +819,12 @@ EXPORT SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels,
st
->
buffer_size
=
160
;
/* Per channel data */
st
->
last_sample
=
(
spx_int32_t
*
)
speex_alloc
(
nb_channels
*
sizeof
(
spx_int32_t
));
st
->
magic_samples
=
(
spx_uint32_t
*
)
speex_alloc
(
nb_channels
*
sizeof
(
spx_uint32_t
));
st
->
samp_frac_num
=
(
spx_uint32_t
*
)
speex_alloc
(
nb_channels
*
sizeof
(
spx_uint32_t
));
if
(
!
(
st
->
last_sample
=
(
spx_int32_t
*
)
speex_alloc
(
nb_channels
*
sizeof
(
spx_int32_t
))))
goto
fail
;
if
(
!
(
st
->
magic_samples
=
(
spx_uint32_t
*
)
speex_alloc
(
nb_channels
*
sizeof
(
spx_uint32_t
))))
goto
fail
;
if
(
!
(
st
->
samp_frac_num
=
(
spx_uint32_t
*
)
speex_alloc
(
nb_channels
*
sizeof
(
spx_uint32_t
))))
goto
fail
;
for
(
i
=
0
;
i
<
nb_channels
;
i
++
)
{
st
->
last_sample
[
i
]
=
0
;
...
...
@@ -838,6 +847,12 @@ EXPORT SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels,
*
err
=
filter_err
;
return
st
;
fail:
if
(
err
)
*
err
=
RESAMPLER_ERR_ALLOC_FAILED
;
speex_resampler_destroy
(
st
);
return
NULL
;
}
EXPORT
void
speex_resampler_destroy
(
SpeexResamplerState
*
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