summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisael Lopez Cruz2014-11-26 01:24:05 -0600
committerMisael Lopez Cruz2014-11-26 03:06:17 -0600
commit989e6a8edfff8e7966b25428dd5fb1ed585f34be (patch)
tree4f70d9af5373f594fa9f56627125291ef94b2766 /audio/legacy
parent722a512d3b92a94c46c856592ccc7015d2a6fd06 (diff)
downloaddevice-ti-jacinto6evm-989e6a8edfff8e7966b25428dd5fb1ed585f34be.tar.gz
device-ti-jacinto6evm-989e6a8edfff8e7966b25428dd5fb1ed585f34be.tar.xz
device-ti-jacinto6evm-989e6a8edfff8e7966b25428dd5fb1ed585f34be.zip
audio: Legacy: Zero-initialize allocated structs
Initialize to zeros the different structs used in the HAL. The HAL uses non-NULL checks to free temporary audio buffers. There were some aborts caused by freeing unallocated memory because the audio buffer pointers were not zero-initialized. Change-Id: I75ae704d5469e9e028bc7b67ef84b6a4047a7409 Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Diffstat (limited to 'audio/legacy')
-rw-r--r--audio/legacy/audio_hw.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/audio/legacy/audio_hw.c b/audio/legacy/audio_hw.c
index fc81c03..8aa28ab 100644
--- a/audio/legacy/audio_hw.c
+++ b/audio/legacy/audio_hw.c
@@ -309,7 +309,7 @@ static int setup_stereo_to_mono_input_remix(struct j6_stream_in *in)
309{ 309{
310 ALOGV("setup_stereo_to_mono_input_remix() stream=%p", in); 310 ALOGV("setup_stereo_to_mono_input_remix() stream=%p", in);
311 311
312 struct buffer_remix *br = (struct buffer_remix *)malloc(sizeof(struct buffer_remix)); 312 struct buffer_remix *br = (struct buffer_remix *)calloc(1, sizeof(struct buffer_remix));
313 if (!br) 313 if (!br)
314 return -ENOMEM; 314 return -ENOMEM;
315 315
@@ -349,7 +349,7 @@ static int setup_mono_input_remix(struct j6_voice_stream *stream)
349{ 349{
350 ALOGV("setup_mono_input_remix() %s stream", stream->name); 350 ALOGV("setup_mono_input_remix() %s stream", stream->name);
351 351
352 struct buffer_remix *br = (struct buffer_remix *)malloc(sizeof(struct buffer_remix)); 352 struct buffer_remix *br = (struct buffer_remix *)calloc(1, sizeof(struct buffer_remix));
353 if (!br) 353 if (!br)
354 return -ENOMEM; 354 return -ENOMEM;
355 355
@@ -1261,7 +1261,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
1261 struct j6_audio_device *adev = (struct j6_audio_device *)dev; 1261 struct j6_audio_device *adev = (struct j6_audio_device *)dev;
1262 struct j6_stream_out *out; 1262 struct j6_stream_out *out;
1263 1263
1264 out = (struct j6_stream_out *)malloc(sizeof(struct j6_stream_out)); 1264 out = (struct j6_stream_out *)calloc(1, sizeof(struct j6_stream_out));
1265 if (!out) 1265 if (!out)
1266 return -ENOMEM; 1266 return -ENOMEM;
1267 1267
@@ -1442,7 +1442,7 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
1442 struct j6_stream_in *in; 1442 struct j6_stream_in *in;
1443 int ret; 1443 int ret;
1444 1444
1445 in = (struct j6_stream_in *)malloc(sizeof(struct j6_stream_in)); 1445 in = (struct j6_stream_in *)calloc(1, sizeof(struct j6_stream_in));
1446 if (!in) 1446 if (!in)
1447 return -ENOMEM; 1447 return -ENOMEM;
1448 1448
@@ -1582,7 +1582,7 @@ static int adev_open(const hw_module_t* module, const char* name,
1582 if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0) 1582 if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0)
1583 return -EINVAL; 1583 return -EINVAL;
1584 1584
1585 adev = (struct j6_audio_device*)malloc(sizeof(struct j6_audio_device)); 1585 adev = (struct j6_audio_device*)calloc(1, sizeof(struct j6_audio_device));
1586 if (!adev) 1586 if (!adev)
1587 return -ENOMEM; 1587 return -ENOMEM;
1588 1588