[recipes] recipe: Plug a memory leak
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] recipe: Plug a memory leak
- Date: Sun, 5 Mar 2017 03:22:07 +0000 (UTC)
commit c9c5f9eb1b4249ebb39dc0255699f616b6bc0880
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Mar 4 22:07:55 2017 -0500
recipe: Plug a memory leak
I overlooked this small leak when I reviewed the previous patch.
At the same time, fix some formatting glitches.
src/gr-recipe.c | 28 ++++++++++++----------------
1 files changed, 12 insertions(+), 16 deletions(-)
---
diff --git a/src/gr-recipe.c b/src/gr-recipe.c
index 639b7e3..d991a21 100644
--- a/src/gr-recipe.c
+++ b/src/gr-recipe.c
@@ -254,22 +254,17 @@ gr_recipe_get_chef_fullname (GrRecipe *self)
{
GrRecipeStore *store;
g_autoptr(GrChef) chef = NULL;
- char * fullname;
- store = gr_app_get_recipe_store (GR_APP(g_application_get_default()));
- chef = gr_recipe_store_get_chef(store, self->author);
+ store = gr_app_get_recipe_store (GR_APP (g_application_get_default ()));
+ chef = gr_recipe_store_get_chef (store, self->author);
if (chef) {
- fullname = (char *) gr_chef_get_fullname(chef);
-
- if (fullname)
- return g_utf8_casefold(fullname, -1);
- else
- return NULL;
- }
+ const char *fullname = gr_chef_get_fullname (chef);
- else
- return NULL;
+ if (fullname)
+ return g_utf8_casefold (fullname, -1);
+ }
+ return NULL;
}
static void
@@ -717,8 +712,9 @@ gr_recipe_matches (GrRecipe *recipe,
const char **terms)
{
int i;
- char * cf_fullname;
- cf_fullname = gr_recipe_get_chef_fullname(recipe);
+ g_autofree char *cf_fullname = NULL;
+
+ cf_fullname = gr_recipe_get_chef_fullname (recipe);
for (i = 0; terms[i]; i++) {
if (g_str_has_prefix (terms[i], "i+:")) {
@@ -808,8 +804,8 @@ gr_recipe_matches (GrRecipe *recipe,
if (recipe->cf_ingredients && strstr (recipe->cf_ingredients, terms[i]) != NULL)
continue;
-
- if (cf_fullname && strstr(cf_fullname, terms[i]) != NULL)
+
+ if (cf_fullname && strstr (cf_fullname, terms[i]) != NULL)
continue;
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]