[vlc-devel] [RFC 08/38] codec/flac: removed usage of xmalloc
Filip Roséen
filip at videolabs.io
Mon Jun 27 13:43:19 CEST 2016
---
modules/codec/flac.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/modules/codec/flac.c b/modules/codec/flac.c
index 3aca417..4f82487 100644
--- a/modules/codec/flac.c
+++ b/modules/codec/flac.c
@@ -618,8 +618,13 @@ EncoderWriteCallback( const FLAC__StreamEncoder *encoder,
msg_Dbg( p_enc, "Writing STREAMINFO: %zu", bytes );
/* Backup the STREAMINFO metadata block */
+ p_enc->fmt_out.p_extra = malloc( STREAMINFO_SIZE + 8);
+
+ if( unlikely( !p_enc->fmt_out.p_extra ) )
+ return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
+
p_enc->fmt_out.i_extra = STREAMINFO_SIZE + 8;
- p_enc->fmt_out.p_extra = xmalloc( STREAMINFO_SIZE + 8);
+
memcpy(p_enc->fmt_out.p_extra, "fLaC", 4);
memcpy((uint8_t*)p_enc->fmt_out.p_extra + 4, buffer, STREAMINFO_SIZE );
/* Fake this as the last metadata block */
--
2.9.0
More information about the vlc-devel
mailing list