Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leaks #193

Merged
merged 3 commits into from Jun 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -5743,6 +5743,8 @@ as_component_set_from_variant (AsComponent *cpt, GVariant *variant, const gchar
g_variant_unref (var);
}

g_variant_dict_clear (&dict);

return TRUE;
}

@@ -550,6 +550,8 @@ as_content_rating_set_from_variant (AsContentRating *content_rating, GVariant *v
g_variant_unref (v_child);
}

g_variant_dict_clear (&idict);

return TRUE;
}

@@ -536,6 +536,8 @@ as_icon_set_from_variant (AsIcon *icon, GVariant *variant)
as_variant_get_dict_str (&idict, "filename", &ival_var));
}

g_variant_dict_clear (&idict);

return TRUE;
}

@@ -529,6 +529,8 @@ as_image_set_from_variant (AsImage *image, GVariant *variant)
priv->width = as_variant_get_dict_int32 (&dict, "width");
priv->height = as_variant_get_dict_int32 (&dict, "height");

g_variant_dict_clear (&dict);

return TRUE;
}

@@ -1764,6 +1764,7 @@ as_cache_file_read (const gchar *fname, GError **error)
g_warning ("Ignored serialized component: %s", str);
}
}
g_variant_unref (cptv);
}

return cpts;
@@ -1032,6 +1032,8 @@ as_release_set_from_variant (AsRelease *release, GVariant *variant, const gchar
g_variant_unref (tmp);
}

g_variant_dict_clear (&rdict);

return TRUE;
}

@@ -645,9 +645,12 @@ as_screenshot_set_from_variant (AsScreenshot *screenshot, GVariant *variant, con
g_autoptr(AsImage) img = as_image_new ();
if (as_image_set_from_variant (img, img_child))
as_screenshot_add_image (screenshot, img);
g_variant_unref (img_child);
}
}

g_variant_dict_clear (&idict);

return priv->images->len != 0;
}

@@ -291,12 +291,15 @@ as_utils_find_files_matching (const gchar* dir, const gchar* pattern, gboolean r
goto out;

while ((file_info = g_file_enumerator_next_file (enumerator, NULL, &tmp_error)) != NULL) {
gchar *path;
gchar *path = NULL;
gboolean stop = FALSE;

if (tmp_error != NULL)
goto out;
if (tmp_error != NULL) {
stop = TRUE;
goto done;
}
if (g_file_info_get_is_hidden (file_info))
continue;
goto done;

path = g_build_filename (dir,
g_file_info_get_name (file_info),
@@ -310,8 +313,8 @@ as_utils_find_files_matching (const gchar* dir, const gchar* pattern, gboolean r
if (subdir_list == NULL) {
g_ptr_array_unref (list);
list = NULL;
g_free (path);
goto out;
stop = TRUE;
goto done;
}
for (i=0; i<subdir_list->len; i++)
g_ptr_array_add (list,
@@ -320,12 +323,18 @@ as_utils_find_files_matching (const gchar* dir, const gchar* pattern, gboolean r
} else {
if (!as_str_empty (pattern)) {
if (!g_pattern_match_simple (pattern, g_file_info_get_name (file_info))) {
g_free (path);
continue;
goto done;
}
}
g_ptr_array_add (list, path);
path = NULL;
}

done:
g_object_unref (file_info);
g_free (path);
if (stop)
break;
}