Message ID | 1398952881-27828-2-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 05/01/2014 10:01 PM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Forgot to free the hdr if the hdr length is too small. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/lib/src/fwts_acpi_tables.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c > index e40583e..d6ab1ce 100644 > --- a/src/lib/src/fwts_acpi_tables.c > +++ b/src/lib/src/fwts_acpi_tables.c > @@ -172,8 +172,10 @@ static void *fwts_acpi_load_table(const off_t addr) > return NULL; > > len = hdr->length; > - if (len < (int)sizeof(fwts_acpi_table_header)) > + if (len < (int)sizeof(fwts_acpi_table_header)) { > + (void)fwts_munmap(hdr, sizeof(fwts_acpi_table_header)); > return NULL; > + } > > (void)fwts_munmap(hdr, sizeof(fwts_acpi_table_header)); > > Acked-by: Ivan Hu <ivan.hu@canonical.com>
On 05/01/2014 10:01 PM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Forgot to free the hdr if the hdr length is too small. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/lib/src/fwts_acpi_tables.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c > index e40583e..d6ab1ce 100644 > --- a/src/lib/src/fwts_acpi_tables.c > +++ b/src/lib/src/fwts_acpi_tables.c > @@ -172,8 +172,10 @@ static void *fwts_acpi_load_table(const off_t addr) > return NULL; > > len = hdr->length; > - if (len < (int)sizeof(fwts_acpi_table_header)) > + if (len < (int)sizeof(fwts_acpi_table_header)) { > + (void)fwts_munmap(hdr, sizeof(fwts_acpi_table_header)); > return NULL; > + } > > (void)fwts_munmap(hdr, sizeof(fwts_acpi_table_header)); > > Acked-by: Alex Hung <alex.hung@canonical.com>
diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c index e40583e..d6ab1ce 100644 --- a/src/lib/src/fwts_acpi_tables.c +++ b/src/lib/src/fwts_acpi_tables.c @@ -172,8 +172,10 @@ static void *fwts_acpi_load_table(const off_t addr) return NULL; len = hdr->length; - if (len < (int)sizeof(fwts_acpi_table_header)) + if (len < (int)sizeof(fwts_acpi_table_header)) { + (void)fwts_munmap(hdr, sizeof(fwts_acpi_table_header)); return NULL; + } (void)fwts_munmap(hdr, sizeof(fwts_acpi_table_header));