diff options
author | Umang Jain <umang@endlessm.com> | 2019-03-26 15:47:54 +0530 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2019-03-26 12:10:52 +0000 |
commit | dcde1473d3db14369cde96108c7f12b3d2a99c16 (patch) | |
tree | 2d7a875b2b3c30db70fc30b0c53d39e08e9c73a3 | |
parent | a9107feeb4b8275b78965b36bf21b92d5724699e (diff) | |
download | flatpak-dcde1473d3db14369cde96108c7f12b3d2a99c16.tar.gz |
trivial: Use g_autoptr to automatically free GErrors
Closes: #2785
Approved by: matthiasclasen
-rw-r--r-- | app/flatpak-main.c | 3 | ||||
-rw-r--r-- | common/flatpak-dir.c | 14 |
2 files changed, 5 insertions, 12 deletions
diff --git a/app/flatpak-main.c b/app/flatpak-main.c index 0e468b19..6658f9c7 100644 --- a/app/flatpak-main.c +++ b/app/flatpak-main.c @@ -764,7 +764,7 @@ int main (int argc, char **argv) { - GError *error = NULL; + g_autoptr(GError) error = NULL; g_autofree const char *old_env = NULL; int ret; struct sigaction action; @@ -812,7 +812,6 @@ main (int argc, } g_dbus_error_strip_remote_error (error); g_printerr ("%s%s %s%s\n", prefix, _("error:"), suffix, error->message); - g_error_free (error); } return ret; diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index 2b591000..6e16ceb4 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -8905,13 +8905,10 @@ flatpak_dir_undeploy (FlatpakDir *self, if (force_remove || !dir_is_locked (removed_subdir)) { - GError *tmp_error = NULL; + g_autoptr(GError) tmp_error = NULL; if (!flatpak_rm_rf (removed_subdir, cancellable, &tmp_error)) - { - g_warning ("Unable to remove old checkout: %s", tmp_error->message); - g_error_free (tmp_error); - } + g_warning ("Unable to remove old checkout: %s", tmp_error->message); } return TRUE; @@ -9063,12 +9060,9 @@ flatpak_dir_cleanup_removed (FlatpakDir *self, if (g_file_info_get_file_type (child_info) == G_FILE_TYPE_DIRECTORY && !dir_is_locked (child)) { - GError *tmp_error = NULL; + g_autoptr(GError) tmp_error = NULL; if (!flatpak_rm_rf (child, cancellable, &tmp_error)) - { - g_warning ("Unable to remove old checkout: %s", tmp_error->message); - g_error_free (tmp_error); - } + g_warning ("Unable to remove old checkout: %s", tmp_error->message); } g_clear_object (&child_info); |