From dff24533071f260d3c77f1563b0cb7b7ddec1a9b Mon Sep 17 00:00:00 2001 From: José Bollo Date: Tue, 31 Oct 2017 16:17:27 +0100 Subject: fix allocation size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ia1a2ed447fd9b5831eec58606a0f7694e6569017 Signed-off-by: José Bollo --- alsa-binding/Alsa-AddCtl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/alsa-binding/Alsa-AddCtl.c b/alsa-binding/Alsa-AddCtl.c index 3f969c1..108a590 100644 --- a/alsa-binding/Alsa-AddCtl.c +++ b/alsa-binding/Alsa-AddCtl.c @@ -74,12 +74,12 @@ static const unsigned int *allocate_int_dbscale_tlv(int min, int step, int mute) static const unsigned int *allocate_int_linear_tlv(int max, int min) { // SNDRV_CTL_TLVD_DECLARE_DB_LINEAR (range, min, max); - size_t tlvSize = sizeof (4 * sizeof (unsigned int)); - unsigned int *tlv = malloc(tlvSize); + size_t tlvSize = 4 * sizeof (unsigned int); + unsigned int *tlv = malloc(4 * sizeof (unsigned int)); tlv[0] = SNDRV_CTL_TLVT_DB_LINEAR; - tlv[1] = (int) tlvSize; - tlv[2] = -min * 100; - tlv[3] = max * 100; + tlv[1] = (unsigned int)(2 * sizeof (unsigned int)); + tlv[2] = (unsigned int)(-min * 100); + tlv[3] = (unsigned int)(max * 100); return tlv; } -- cgit 1.2.3-korg