Patchwork acpi: dmar: free klog list on error

login
register
mail settings
Submitter Colin King
Date May 6, 2013, 10:35 p.m.
Message ID <1367879721-19507-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/241809/
State Accepted
Headers show

Comments

Colin King - May 6, 2013, 10:35 p.m.
From: Colin Ian King <colin.king@canonical.com>

Coverity CID #997269, Resource leak.

Need to free klog list before we return.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/dmar/dmar.c | 1 +
 1 file changed, 1 insertion(+)
Alex Hung - May 7, 2013, 5:56 a.m.
On 05/07/2013 06:35 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Coverity CID #997269, Resource leak.
>
> Need to free klog list before we return.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/dmar/dmar.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/src/acpi/dmar/dmar.c b/src/acpi/dmar/dmar.c
> index bd6511b..6505a94 100644
> --- a/src/acpi/dmar/dmar.c
> +++ b/src/acpi/dmar/dmar.c
> @@ -316,6 +316,7 @@ static int dmar_test1(fwts_framework *fw)
>   		if (fwts_klog_scan(fw, klog, acpiinfo_check,
>   			NULL, NULL, &errors)) {
>                   	fwts_log_error(fw, "Failed to scan kernel log.");
> +			fwts_klog_free(klog);
>                   	return FWTS_ERROR;
>   		}
>   		if (errors == 0)
>
Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu - May 16, 2013, 2:15 a.m.
On 05/07/2013 06:35 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Coverity CID #997269, Resource leak.
>
> Need to free klog list before we return.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/dmar/dmar.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/src/acpi/dmar/dmar.c b/src/acpi/dmar/dmar.c
> index bd6511b..6505a94 100644
> --- a/src/acpi/dmar/dmar.c
> +++ b/src/acpi/dmar/dmar.c
> @@ -316,6 +316,7 @@ static int dmar_test1(fwts_framework *fw)
>   		if (fwts_klog_scan(fw, klog, acpiinfo_check,
>   			NULL, NULL, &errors)) {
>                   	fwts_log_error(fw, "Failed to scan kernel log.");
> +			fwts_klog_free(klog);
>                   	return FWTS_ERROR;
>   		}
>   		if (errors == 0)
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch

diff --git a/src/acpi/dmar/dmar.c b/src/acpi/dmar/dmar.c
index bd6511b..6505a94 100644
--- a/src/acpi/dmar/dmar.c
+++ b/src/acpi/dmar/dmar.c
@@ -316,6 +316,7 @@  static int dmar_test1(fwts_framework *fw)
 		if (fwts_klog_scan(fw, klog, acpiinfo_check,
 			NULL, NULL, &errors)) {
                 	fwts_log_error(fw, "Failed to scan kernel log.");
+			fwts_klog_free(klog);
                 	return FWTS_ERROR;
 		}
 		if (errors == 0)