From patchwork Fri Mar 2 09:52:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/2] bios: hdaaudio: use calloc() instead of malloc() Date: Thu, 01 Mar 2012 23:52:26 -0000 From: Colin King X-Patchwork-Id: 144182 Message-Id: <1330681947-17406-2-git-send-email-colin.king@canonical.com> To: fwts-devel@lists.ubuntu.com From: Colin Ian King Signed-off-by: Colin Ian King Acked-by: Keng-Yu Lin Acked-by: Alex Hung --- src/bios/hdaaudio/hdaaudio.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/bios/hdaaudio/hdaaudio.c b/src/bios/hdaaudio/hdaaudio.c index b49f202..7dc1823 100644 --- a/src/bios/hdaaudio/hdaaudio.c +++ b/src/bios/hdaaudio/hdaaudio.c @@ -43,7 +43,8 @@ static int hda_audio_read_pins(fwts_framework *fw, const char *path, return FWTS_ERROR; while (fscanf(fp, "0x%hx 0x%x\n", &pin, &setting) == 2) { - if ((pin_setting = malloc(sizeof(hda_audio_pin_setting))) == NULL) { + pin_setting = calloc(1, sizeof(hda_audio_pin_setting)); + if (pin_setting == NULL) { fwts_list_free(settings, free); fclose(fp); return FWTS_ERROR;