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
This commit is contained in:
Philip Withnall 2014-05-15 10:30:38 +01:00
parent 195a0cb6bb
commit 16d674411f

View File

@ -953,6 +953,7 @@ handle_overwrite_open (const char *filename,
G_IO_ERROR_CANT_CREATE_BACKUP, G_IO_ERROR_CANT_CREATE_BACKUP,
_("Backup file creation failed")); _("Backup file creation failed"));
g_unlink (backup_filename); g_unlink (backup_filename);
(void) g_close (bfd, NULL);
g_free (backup_filename); g_free (backup_filename);
goto err_out; goto err_out;
} }