Re: [PATCH 1/2] Use correct g_free() function
- From: Dan Williams <dcbw redhat com>
- To: Thomas Jarosch <thomas jarosch intra2net com>
- Cc: networkmanager-list gnome org
- Subject: Re: [PATCH 1/2] Use correct g_free() function
- Date: Wed, 05 Oct 2011 12:40:51 -0500
On Tue, 2011-10-04 at 22:22 +0200, Thomas Jarosch wrote:
> Detected by cppcheck.
Thanks, applied. Looks like the other two variables there (var1 and
var2) also need to be freed with g_free() since they are allocated using
glib functions. I've added that to your patch.
Dan
> Signed-off-by: Thomas Jarosch <thomas jarosch intra2net com>
> ---
> src/settings/plugins/ifcfg-rh/shvar.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/settings/plugins/ifcfg-rh/shvar.c b/src/settings/plugins/ifcfg-rh/shvar.c
> index c740801..4f8ddd6 100644
> --- a/src/settings/plugins/ifcfg-rh/shvar.c
> +++ b/src/settings/plugins/ifcfg-rh/shvar.c
> @@ -336,13 +336,13 @@ svSetValue(shvarFile *s, const char *key, const char *value, gboolean verbatim)
> }
>
> end:
> - if (newval) free(newval);
> + if (newval) g_free(newval);
> if (val1) free(val1);
> if (val2) free(val2);
> return;
>
> bail:
> - if (keyValue) free (keyValue);
> + if (keyValue) g_free (keyValue);
> goto end;
> }
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]