GNOME Bugzilla – Bug 730187
glocalfileoutputstream: Fix an FD leak in an error path
Last modified: 2016-06-16 18:49:09 UTC
Patch attached.
Created attachment 276596 [details] [review] 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
Review of attachment 276596 [details] [review]: ...note below, but feel free to handle that in a separate patch. ::: gio/glocalfileoutputstream.c @@ +954,3 @@ _("Backup file creation failed")); g_unlink (backup_filename); + (void) g_close (bfd, NULL); Drop the (void) thing, but otherwise looks good. Thanks!
Pushed. I'll push a follow-up to remove all (void) the (void) random (void) void (void) casts. Attachment 276596 [details] pushed as 16d6744 - glocalfileoutputstream: Fix an FD leak in an error path
(In reply to Allison Lortie (desrt) from comment #2) > Drop the (void) thing, but otherwise looks good. Thanks! I often use that because at least Coverity complains if a return value is checked in some places but not others.
(In reply to Colin Walters from comment #4) > (In reply to Allison Lortie (desrt) from comment #2) > > > Drop the (void) thing, but otherwise looks good. Thanks! > > I often use that because at least Coverity complains if a return value is > checked in some places but not others. Hmm, good point. I've already pushed a commit to remove them (fadd00c7085fd0dc2722c974260768540cc6f8b9), but we can revert it if the next Coverity run gets upset. Alternatively, we mark those Coverity issues as ignored, which should persist through to future runs.