[vlc-devel] [RFC 19/38] codec/lpcm: replaces usage of xmalloc
Filip Roséen
filip at videolabs.io
Mon Jun 27 13:43:30 CEST 2016
---
modules/codec/lpcm.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/modules/codec/lpcm.c b/modules/codec/lpcm.c
index de13c28..dbd5a98 100644
--- a/modules/codec/lpcm.c
+++ b/modules/codec/lpcm.c
@@ -540,11 +540,17 @@ static int OpenEncoder( vlc_object_t *p_this )
/* In DVD LCPM, a frame is always 150 PTS ticks. */
p_sys->i_frame_samples = p_enc->fmt_in.audio.i_rate * 150 / 90000;
- p_sys->p_buffer = xmalloc(p_sys->i_frame_samples
+ p_sys->p_buffer = malloc(p_sys->i_frame_samples
* p_enc->fmt_in.audio.i_channels * 16);
+
+ if( unlikely( !p_sys->p_buffer ) )
+ {
+ free( p_sys );
+ return VLC_ENOMEM;
+ }
+
p_sys->i_buffer_used = 0;
p_sys->i_frame_num = 0;
-
p_sys->i_channels = p_enc->fmt_in.audio.i_channels;
p_sys->i_rate = p_enc->fmt_in.audio.i_rate;
--
2.9.0
More information about the vlc-devel
mailing list