summaryrefslogtreecommitdiff
path: root/gio/gfile.c
diff options
context:
space:
mode:
authorPaolo Borelli <pborelli@katamail.com>2008-06-10 11:40:45 +0000
committerPaolo Borelli <pborelli@src.gnome.org>2008-06-10 11:40:45 +0000
commit9944e93fdaad187017d34d69e1c0058fc920289c (patch)
tree31d39ea15eca0b3efc390990899384adf9b3f355 /gio/gfile.c
parent6908da5a57714cf33b0c9e459fe9f9d0a6cb904b (diff)
do not leak the output stream.
2008-06-10 Paolo Borelli <pborelli@katamail.com> * gfile.c (g_file_replace_contents): do not leak the output stream. svn path=/trunk/; revision=6984
Diffstat (limited to 'gio/gfile.c')
-rw-r--r--gio/gfile.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gio/gfile.c b/gio/gfile.c
index 941fa81f5..a4cbd9b0a 100644
--- a/gio/gfile.c
+++ b/gio/gfile.c
@@ -5411,6 +5411,7 @@ g_file_replace_contents (GFile *file,
GFileOutputStream *out;
gsize pos, remainder;
gssize res;
+ gboolean ret;
g_return_val_if_fail (G_IS_FILE (file), FALSE);
g_return_val_if_fail (contents != NULL, FALSE);
@@ -5436,18 +5437,19 @@ g_file_replace_contents (GFile *file,
{
/* Ignore errors on close */
g_output_stream_close (G_OUTPUT_STREAM (out), cancellable, NULL);
-
+ g_object_unref (out);
+
/* error is set already */
return FALSE;
}
- if (!g_output_stream_close (G_OUTPUT_STREAM (out), cancellable, error))
- return FALSE;
+ ret = g_output_stream_close (G_OUTPUT_STREAM (out), cancellable, error);
+ g_object_unref (out);
if (new_etag)
*new_etag = g_file_output_stream_get_etag (out);
-
- return TRUE;
+
+ return ret;
}
typedef struct {