Message ID | 1367878804-18734-1-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 05/07/2013 06:20 AM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Free mtrr_list on file open error to fix resource leak bug. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/bios/mtrr/mtrr.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c > index 284d153..38f89fb 100644 > --- a/src/bios/mtrr/mtrr.c > +++ b/src/bios/mtrr/mtrr.c > @@ -88,8 +88,10 @@ static int get_mtrrs(void) > if ((mtrr_list = fwts_list_new()) == NULL) > return FWTS_ERROR; > > - if ((fp = fopen("/proc/mtrr", "r")) == NULL) > + if ((fp = fopen("/proc/mtrr", "r")) == NULL) { > + fwts_list_free(mtrr_list, free); > return FWTS_ERROR; > + } > > while (!feof(fp)) { > char *ptr1, *ptr2; > Acked-by: Alex Hung <alex.hung@canonical.com>
On 05/07/2013 06:20 AM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Free mtrr_list on file open error to fix resource leak bug. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/bios/mtrr/mtrr.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c > index 284d153..38f89fb 100644 > --- a/src/bios/mtrr/mtrr.c > +++ b/src/bios/mtrr/mtrr.c > @@ -88,8 +88,10 @@ static int get_mtrrs(void) > if ((mtrr_list = fwts_list_new()) == NULL) > return FWTS_ERROR; > > - if ((fp = fopen("/proc/mtrr", "r")) == NULL) > + if ((fp = fopen("/proc/mtrr", "r")) == NULL) { > + fwts_list_free(mtrr_list, free); > return FWTS_ERROR; > + } > > while (!feof(fp)) { > char *ptr1, *ptr2; > Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c index 284d153..38f89fb 100644 --- a/src/bios/mtrr/mtrr.c +++ b/src/bios/mtrr/mtrr.c @@ -88,8 +88,10 @@ static int get_mtrrs(void) if ((mtrr_list = fwts_list_new()) == NULL) return FWTS_ERROR; - if ((fp = fopen("/proc/mtrr", "r")) == NULL) + if ((fp = fopen("/proc/mtrr", "r")) == NULL) { + fwts_list_free(mtrr_list, free); return FWTS_ERROR; + } while (!feof(fp)) { char *ptr1, *ptr2;