diff mbox

lib: fwts_klog: remove redundant free()

Message ID 1331210892-27643-1-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King March 8, 2012, 12:48 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_klog.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

Comments

Alex Hung March 9, 2012, 1:58 a.m. UTC | #1
On 03/08/2012 08:48 PM, Colin King wrote:
> From: Colin Ian King<colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King<colin.king@canonical.com>
> ---
>   src/lib/src/fwts_klog.c |    4 +---
>   1 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/src/lib/src/fwts_klog.c b/src/lib/src/fwts_klog.c
> index 39e8183..7b7fb41 100644
> --- a/src/lib/src/fwts_klog.c
> +++ b/src/lib/src/fwts_klog.c
> @@ -66,10 +66,8 @@ fwts_list *fwts_klog_read(void)
>   	if ((len = klogctl(10, NULL, 0))<  0)
>   		return NULL;
>
> -	if ((buffer = calloc(1, len)) == NULL) {
> -		free(buffer);
> +	if ((buffer = calloc(1, len)) == NULL)
>   		return NULL;
> -	}
>   	
>   	if (klogctl(3, buffer, len)<  0) {
>   		free(buffer);
Acked-by: Alex Hung <alex.hung@canonical.com>
Keng-Yu Lin March 9, 2012, 5:38 a.m. UTC | #2
On Thu, Mar 8, 2012 at 8:48 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_klog.c |    4 +---
>  1 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/src/lib/src/fwts_klog.c b/src/lib/src/fwts_klog.c
> index 39e8183..7b7fb41 100644
> --- a/src/lib/src/fwts_klog.c
> +++ b/src/lib/src/fwts_klog.c
> @@ -66,10 +66,8 @@ fwts_list *fwts_klog_read(void)
>        if ((len = klogctl(10, NULL, 0)) < 0)
>                return NULL;
>
> -       if ((buffer = calloc(1, len)) == NULL) {
> -               free(buffer);
> +       if ((buffer = calloc(1, len)) == NULL)
>                return NULL;
> -       }
>
>        if (klogctl(3, buffer, len) < 0) {
>                free(buffer);
> --
> 1.7.9
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
diff mbox

Patch

diff --git a/src/lib/src/fwts_klog.c b/src/lib/src/fwts_klog.c
index 39e8183..7b7fb41 100644
--- a/src/lib/src/fwts_klog.c
+++ b/src/lib/src/fwts_klog.c
@@ -66,10 +66,8 @@  fwts_list *fwts_klog_read(void)
 	if ((len = klogctl(10, NULL, 0)) < 0)
 		return NULL;
 
-	if ((buffer = calloc(1, len)) == NULL) {
-		free(buffer);
+	if ((buffer = calloc(1, len)) == NULL)
 		return NULL;
-	}
 	
 	if (klogctl(3, buffer, len) < 0) {
 		free(buffer);