From 16d674411f769360fe047b3fd542d47fd05fa65e Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 15 May 2014 10:30:38 +0100 Subject: [PATCH] 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 file changed, 1 insertion(+) diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c index b8fd45c35..b4f348ebd 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; }