Patchwork Revert "acpi: s3: free quirks and command resources"

login
register
mail settings
Submitter Colin King
Date May 20, 2013, 10:08 a.m.
Message ID <1369044510-22856-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/244876/
State Accepted
Headers show

Comments

Colin King - May 20, 2013, 10:08 a.m.
From: Colin Ian King <colin.king@canonical.com>

This fix is bogus and causes a double free. Revert it.

This reverts commit 33cca4e48b90e1c5c8d660bb288f57f0c9596b58.
---
 src/acpi/s3/s3.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
Alex Hung - May 22, 2013, 1:52 a.m.
On 05/20/2013 06:08 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> This fix is bogus and causes a double free. Revert it.
>
> This reverts commit 33cca4e48b90e1c5c8d660bb288f57f0c9596b58.
> ---
>   src/acpi/s3/s3.c | 9 ++-------
>   1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
> index 459cc97..ad1f564 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 = NULL;
> -	char *quirks = NULL;
> +	char *command;
> +	char *quirks;
>   	char buffer[80];
>
>   	fwts_klog_clear();
> @@ -184,11 +184,6 @@ 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;
>   }
>
>
Acked-by: Alex Hung <alex.hung@canonical.com>
Keng-Yu Lin - May 22, 2013, 2:23 a.m.
On Mon, May 20, 2013 at 6:08 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> This fix is bogus and causes a double free. Revert it.
>
> This reverts commit 33cca4e48b90e1c5c8d660bb288f57f0c9596b58.
> ---
>  src/acpi/s3/s3.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
> index 459cc97..ad1f564 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 = NULL;
> -       char *quirks = NULL;
> +       char *command;
> +       char *quirks;
>         char buffer[80];
>
>         fwts_klog_clear();
> @@ -184,11 +184,6 @@ 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
>

Acked-by: Keng-Yu Lin <kengyu@canonical.com>

Patch

diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
index 459cc97..ad1f564 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 = NULL;
-	char *quirks = NULL;
+	char *command;
+	char *quirks;
 	char buffer[80];
 
 	fwts_klog_clear();
@@ -184,11 +184,6 @@  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;
 }