[glib] glocalfileoutputstream: Fix an FD leak in an error path
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] glocalfileoutputstream: Fix an FD leak in an error path
- Date: Thu, 16 Jun 2016 18:39:17 +0000 (UTC)
commit 16d674411f769360fe047b3fd542d47fd05fa65e
Author: Philip Withnall <philip withnall collabora co uk>
Date: Thu May 15 10:30:38 2014 +0100
glocalfileoutputstream: Fix an FD leak in an error path
If a backup file is created, opened successfully, then fstat() on it
fails (perhaps due to another process deleting it in the mean time?),
the FD will be leaked.
Coverity issue: #1159485
https://bugzilla.gnome.org/show_bug.cgi?id=730187
gio/glocalfileoutputstream.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c
index b8fd45c..b4f348e 100644
--- a/gio/glocalfileoutputstream.c
+++ b/gio/glocalfileoutputstream.c
@@ -953,6 +953,7 @@ handle_overwrite_open (const char *filename,
G_IO_ERROR_CANT_CREATE_BACKUP,
_("Backup file creation failed"));
g_unlink (backup_filename);
+ (void) g_close (bfd, NULL);
g_free (backup_filename);
goto err_out;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]