[PATCH 1/2] bios: hdaaudio: use calloc() instead of malloc()
Keng-Yü Lin
kengyu at canonical.com
Mon Mar 5 09:01:26 UTC 2012
On Fri, Mar 2, 2012 at 5:52 PM, Colin King <colin.king at canonical.com> wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> 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;
> --
> 1.7.9
>
Acked-by: Keng-Yu Lin <kengyu at canonical.com>
More information about the fwts-devel
mailing list