[PATCH] acpi: s3: free quirks and command resources

Colin King colin.king at canonical.com
Mon May 6 23:00:44 UTC 2013


From: Colin Ian King <colin.king at canonical.com>

Coverity CID #997264, Resource leak.

Need to free quirks and command before we return.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/acpi/s3/s3.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
index ae89423..7528ec2 100644
--- a/src/acpi/s3/s3.c
+++ b/src/acpi/s3/s3.c
@@ -73,8 +73,8 @@ static int s3_do_suspend_resume(fwts_framework *fw,
 	int differences;
 	time_t t_start;
 	time_t t_end;
-	char *command;
-	char *quirks;
+	char *command = NULL;
+	char *quirks = NULL;
 	char buffer[80];
 
 	fwts_klog_clear();
@@ -183,6 +183,11 @@ static int s3_do_suspend_resume(fwts_framework *fw,
 		fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT);
 	}
 
+	if (command)
+		free(command);
+	if (quirks)
+		free(quirks);
+
 	return FWTS_OK;
 }
 
-- 
1.8.1.2




More information about the fwts-devel mailing list