Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: use av_malloc(z)_array()

2015-04-14 Thread Thilo Borgmann
Am 13.04.15 um 21:44 schrieb Michael Niedermayer:
 On Mon, Apr 13, 2015 at 06:49:04PM +, Paul B Mahol wrote:
 Signed-off-by: Paul B Mahol one...@gmail.com
 ---
  libavcodec/alsdec.c | 61 
 ++---
  1 file changed, 30 insertions(+), 31 deletions(-)
 
 LGTM

OK

-Thilo

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: use av_malloc(z)_array()

2015-04-14 Thread Paul B Mahol
On 4/14/15, Thilo Borgmann thilo.borgm...@mail.de wrote:
 Am 13.04.15 um 21:44 schrieb Michael Niedermayer:
 On Mon, Apr 13, 2015 at 06:49:04PM +, Paul B Mahol wrote:
 Signed-off-by: Paul B Mahol one...@gmail.com
 ---
  libavcodec/alsdec.c | 61
 ++---
  1 file changed, 30 insertions(+), 31 deletions(-)

 LGTM

 OK

applied
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/alsdec: use av_malloc(z)_array()

2015-04-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol one...@gmail.com
---
 libavcodec/alsdec.c | 61 ++---
 1 file changed, 30 insertions(+), 31 deletions(-)

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index bac434f..65aa7d2 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -352,7 +352,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
 if (get_bits_left(gb)  bits_needed)
 return AVERROR_INVALIDDATA;
 
-if (!(sconf-chan_pos = av_malloc(avctx-channels * 
sizeof(*sconf-chan_pos
+if (!(sconf-chan_pos = av_malloc_array(avctx-channels, 
sizeof(*sconf-chan_pos
 return AVERROR(ENOMEM);
 
 ctx-cs_switch = 1;
@@ -1680,14 +1680,14 @@ static av_cold int decode_init(AVCodecContext *avctx)
 // allocate quantized parcor coefficient buffer
 num_buffers = sconf-mc_coding ? avctx-channels : 1;
 
-ctx-quant_cof= av_malloc(sizeof(*ctx-quant_cof) * num_buffers);
-ctx-lpc_cof  = av_malloc(sizeof(*ctx-lpc_cof)   * num_buffers);
-ctx-quant_cof_buffer = av_malloc(sizeof(*ctx-quant_cof_buffer) *
-  num_buffers * sconf-max_order);
-ctx-lpc_cof_buffer   = av_malloc(sizeof(*ctx-lpc_cof_buffer) *
-  num_buffers * sconf-max_order);
-ctx-lpc_cof_reversed_buffer = av_malloc(sizeof(*ctx-lpc_cof_buffer) *
- sconf-max_order);
+ctx-quant_cof= av_malloc_array(num_buffers, 
sizeof(*ctx-quant_cof));
+ctx-lpc_cof  = av_malloc_array(num_buffers, 
sizeof(*ctx-lpc_cof));
+ctx-quant_cof_buffer = av_malloc_array(num_buffers * sconf-max_order,
+sizeof(*ctx-quant_cof_buffer));
+ctx-lpc_cof_buffer   = av_malloc_array(num_buffers * sconf-max_order,
+sizeof(*ctx-lpc_cof_buffer));
+ctx-lpc_cof_reversed_buffer = av_malloc_array(sconf-max_order,
+   
sizeof(*ctx-lpc_cof_buffer));
 
 if (!ctx-quant_cof  || !ctx-lpc_cof||
 !ctx-quant_cof_buffer   || !ctx-lpc_cof_buffer ||
@@ -1704,15 +1704,14 @@ static av_cold int decode_init(AVCodecContext *avctx)
 }
 
 // allocate and assign lag and gain data buffer for ltp mode
-ctx-const_block = av_malloc (sizeof(*ctx-const_block) * num_buffers);
-ctx-shift_lsbs  = av_malloc (sizeof(*ctx-shift_lsbs)  * num_buffers);
-ctx-opt_order   = av_malloc (sizeof(*ctx-opt_order)   * num_buffers);
-ctx-store_prev_samples = av_malloc(sizeof(*ctx-store_prev_samples) * 
num_buffers);
-ctx-use_ltp = av_mallocz(sizeof(*ctx-use_ltp)  * num_buffers);
-ctx-ltp_lag = av_malloc (sizeof(*ctx-ltp_lag)  * num_buffers);
-ctx-ltp_gain= av_malloc (sizeof(*ctx-ltp_gain) * num_buffers);
-ctx-ltp_gain_buffer = av_malloc (sizeof(*ctx-ltp_gain_buffer) *
-  num_buffers * 5);
+ctx-const_block = av_malloc_array(num_buffers, 
sizeof(*ctx-const_block));
+ctx-shift_lsbs  = av_malloc_array(num_buffers, 
sizeof(*ctx-shift_lsbs));
+ctx-opt_order   = av_malloc_array(num_buffers, 
sizeof(*ctx-opt_order));
+ctx-store_prev_samples = av_malloc_array(num_buffers, 
sizeof(*ctx-store_prev_samples));
+ctx-use_ltp = av_mallocz_array(num_buffers, 
sizeof(*ctx-use_ltp));
+ctx-ltp_lag = av_malloc_array(num_buffers, sizeof(*ctx-ltp_lag));
+ctx-ltp_gain= av_malloc_array(num_buffers, 
sizeof(*ctx-ltp_gain));
+ctx-ltp_gain_buffer = av_malloc_array(num_buffers * 5, 
sizeof(*ctx-ltp_gain_buffer));
 
 if (!ctx-const_block || !ctx-shift_lsbs ||
 !ctx-opt_order || !ctx-store_prev_samples ||
@@ -1728,12 +1727,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
 // allocate and assign channel data buffer for mcc mode
 if (sconf-mc_coding) {
-ctx-chan_data_buffer  = av_malloc(sizeof(*ctx-chan_data_buffer) *
-   num_buffers * num_buffers);
-ctx-chan_data = av_malloc(sizeof(*ctx-chan_data) *
-   num_buffers);
-ctx-reverted_channels = av_malloc(sizeof(*ctx-reverted_channels) *
-   num_buffers);
+ctx-chan_data_buffer  = av_malloc_array(num_buffers * num_buffers,
+ 
sizeof(*ctx-chan_data_buffer));
+ctx-chan_data = av_malloc_array(num_buffers,
+ sizeof(*ctx-chan_data));
+ctx-reverted_channels = av_malloc_array(num_buffers,
+ 
sizeof(*ctx-reverted_channels));
 
 if (!ctx-chan_data_buffer || !ctx-chan_data || 
!ctx-reverted_channels) {
 av_log(avctx, AV_LOG_ERROR, 

Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: use av_malloc(z)_array()

2015-04-13 Thread Michael Niedermayer
On Mon, Apr 13, 2015 at 06:49:04PM +, Paul B Mahol wrote:
 Signed-off-by: Paul B Mahol one...@gmail.com
 ---
  libavcodec/alsdec.c | 61 
 ++---
  1 file changed, 30 insertions(+), 31 deletions(-)

LGTM

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel