Message ID | 1330681947-17406-2-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On Fri, Mar 2, 2012 at 5:52 PM, Colin King <colin.king@canonical.com> wrote: > From: Colin Ian King <colin.king@canonical.com> > > Signed-off-by: Colin Ian King <colin.king@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@canonical.com>
On 03/02/2012 05:52 PM, Colin King wrote: > From: Colin Ian King<colin.king@canonical.com> > > Signed-off-by: Colin Ian King<colin.king@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@canonical.com>
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;