[glib] gio-tool-save: Prevent overwriting error



commit c7f2a7e431eb48b64fc544b04cbd0dd61eb07f4f
Author: Ondrej Holy <oholy redhat com>
Date:   Fri Aug 11 13:37:29 2017 +0200

    gio-tool-save: Prevent overwriting error
    
    The following warning is shown, when both g_output_stream_write and
    g_output_stream_close fail:
    "GError set over the top of a previous GError or uninitialized memory."
    
    Let's clear the error after use.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786463

 gio/gio-tool-save.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gio/gio-tool-save.c b/gio/gio-tool-save.c
index 370299c..e6b131f 100644
--- a/gio/gio-tool-save.c
+++ b/gio/gio-tool-save.c
@@ -110,7 +110,7 @@ save (GFile *file)
                {
                  save_res = FALSE;
                   print_error ("%s", error->message);
-                 g_error_free (error);
+                  g_clear_error (error);
                  goto out;
                }
              res -= written;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]