mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-03 14:42:10 +01:00
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
This commit is contained in:
parent
6908da5a57
commit
9944e93fda
@ -1,3 +1,7 @@
|
|||||||
|
2008-06-10 Paolo Borelli <pborelli@katamail.com>
|
||||||
|
|
||||||
|
* gfile.c (g_file_replace_contents): do not leak the output stream.
|
||||||
|
|
||||||
2008-06-10 Michael Natterer <mitch@imendio.com>
|
2008-06-10 Michael Natterer <mitch@imendio.com>
|
||||||
|
|
||||||
* gcontenttype.c (g_content_type_get_icon): fix SEGV by not using
|
* gcontenttype.c (g_content_type_get_icon): fix SEGV by not using
|
||||||
|
@ -5411,6 +5411,7 @@ g_file_replace_contents (GFile *file,
|
|||||||
GFileOutputStream *out;
|
GFileOutputStream *out;
|
||||||
gsize pos, remainder;
|
gsize pos, remainder;
|
||||||
gssize res;
|
gssize res;
|
||||||
|
gboolean ret;
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_FILE (file), FALSE);
|
g_return_val_if_fail (G_IS_FILE (file), FALSE);
|
||||||
g_return_val_if_fail (contents != NULL, FALSE);
|
g_return_val_if_fail (contents != NULL, FALSE);
|
||||||
@ -5436,18 +5437,19 @@ g_file_replace_contents (GFile *file,
|
|||||||
{
|
{
|
||||||
/* Ignore errors on close */
|
/* Ignore errors on close */
|
||||||
g_output_stream_close (G_OUTPUT_STREAM (out), cancellable, NULL);
|
g_output_stream_close (G_OUTPUT_STREAM (out), cancellable, NULL);
|
||||||
|
g_object_unref (out);
|
||||||
|
|
||||||
/* error is set already */
|
/* error is set already */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_output_stream_close (G_OUTPUT_STREAM (out), cancellable, error))
|
ret = g_output_stream_close (G_OUTPUT_STREAM (out), cancellable, error);
|
||||||
return FALSE;
|
g_object_unref (out);
|
||||||
|
|
||||||
if (new_etag)
|
if (new_etag)
|
||||||
*new_etag = g_file_output_stream_get_etag (out);
|
*new_etag = g_file_output_stream_get_etag (out);
|
||||||
|
|
||||||
return TRUE;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user