[gvfs] gvfs-save: Fix error handling



commit b474fa288a7a530dc0e762291c14d4b2a7073193
Author: Ondrej Holy <oholy redhat com>
Date:   Tue Feb 2 13:17:21 2016 +0100

    gvfs-save: Fix error handling
    
    Initalize error to NULL before passing into g_output_stream_close to avoid
    "GError set over the top of a previous GError or uninitialized memory."
    error. Also add missing new-line character in the error message.

 programs/gvfs-save.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/programs/gvfs-save.c b/programs/gvfs-save.c
index 8a1c614..840e929 100644
--- a/programs/gvfs-save.c
+++ b/programs/gvfs-save.c
@@ -102,7 +102,7 @@ save (GFile *file)
              if (written == -1)
                {
                  save_res = FALSE;
-                 g_printerr ("Error writing to stream: %s", error->message);
+                 g_printerr ("Error writing to stream: %s\n", error->message);
                  g_error_free (error);
                  goto out;
                }
@@ -122,6 +122,7 @@ save (GFile *file)
 
  out:
 
+  error = NULL;
   close_res = g_output_stream_close (out, NULL, &error);
   if (!close_res)
     {


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