[PATCH 1/2] bios: hdaaudio: use calloc() instead of malloc()
Alex Hung
alex.hung at canonical.com
Wed Mar 7 09:54:08 UTC 2012
On 03/02/2012 05:52 PM, Colin King 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;
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list