diff mbox

lib: fwts_framework: free just items in list and not list descriptor

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

Commit Message

Colin Ian King May 7, 2013, 7:46 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Coverity CID #997320: Free of address-of expression

We should be just free'ing the items in the list and not the
list descriptor because that is not on the heap.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_framework.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alex Hung May 8, 2013, 2:13 a.m. UTC | #1
On 05/07/2013 03:46 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Coverity CID #997320: Free of address-of expression
>
> We should be just free'ing the items in the list and not the
> list descriptor because that is not on the heap.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_framework.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
> index 67dd3ab..857b54e 100644
> --- a/src/lib/src/fwts_framework.c
> +++ b/src/lib/src/fwts_framework.c
> @@ -925,7 +925,7 @@ static int fwts_framework_filter_error_parse(const char *arg, fwts_list *list)
>   	for (str = (char*)arg; (token = strtok_r(str, ",", &saveptr)) != NULL; str = NULL) {
>   		if (fwts_list_append(list, token) == NULL) {
>   			fprintf(stderr, "Out of memory parsing argument %s\n", arg);
> -			fwts_list_free(list, NULL);
> +			fwts_list_free_items(list, NULL);
>   			return FWTS_ERROR;
>   		}
>   	}
>
Acked-by: Alex Hung <alex.hung@canonical.com>
Keng-Yu Lin May 20, 2013, 7:31 a.m. UTC | #2
On Tue, May 7, 2013 at 3:46 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Coverity CID #997320: Free of address-of expression
>
> We should be just free'ing the items in the list and not the
> list descriptor because that is not on the heap.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_framework.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
> index 67dd3ab..857b54e 100644
> --- a/src/lib/src/fwts_framework.c
> +++ b/src/lib/src/fwts_framework.c
> @@ -925,7 +925,7 @@ static int fwts_framework_filter_error_parse(const char *arg, fwts_list *list)
>         for (str = (char*)arg; (token = strtok_r(str, ",", &saveptr)) != NULL; str = NULL) {
>                 if (fwts_list_append(list, token) == NULL) {
>                         fprintf(stderr, "Out of memory parsing argument %s\n", arg);
> -                       fwts_list_free(list, NULL);
> +                       fwts_list_free_items(list, NULL);
>                         return FWTS_ERROR;
>                 }
>         }
> --
> 1.8.1.2
>

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

Patch

diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
index 67dd3ab..857b54e 100644
--- a/src/lib/src/fwts_framework.c
+++ b/src/lib/src/fwts_framework.c
@@ -925,7 +925,7 @@  static int fwts_framework_filter_error_parse(const char *arg, fwts_list *list)
 	for (str = (char*)arg; (token = strtok_r(str, ",", &saveptr)) != NULL; str = NULL) {
 		if (fwts_list_append(list, token) == NULL) {
 			fprintf(stderr, "Out of memory parsing argument %s\n", arg);
-			fwts_list_free(list, NULL);
+			fwts_list_free_items(list, NULL);
 			return FWTS_ERROR;
 		}
 	}