diff options
author | Christian Persch <chpe@src.gnome.org> | 2021-12-03 13:03:30 +0100 |
---|---|---|
committer | Albert Astals Cid <tsdgeos@yahoo.es> | 2021-12-07 00:16:25 +0000 |
commit | bb3f7206b3f1cde757384474414a91cdfd3bcb63 (patch) | |
tree | 97c3d79eaea798bae9988fdbbce1eea9ae82e855 /glib/poppler-attachment.cc | |
parent | 274626018dc7693cb98f8e2538c44b19bc9b7c11 (diff) |
glib: Close file descriptors on error
When fdopen fails, the file descriptor must be closed manually so it
doesn't leak.
Diffstat (limited to 'glib/poppler-attachment.cc')
-rw-r--r-- | glib/poppler-attachment.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/glib/poppler-attachment.cc b/glib/poppler-attachment.cc index b44edded..2af11044 100644 --- a/glib/poppler-attachment.cc +++ b/glib/poppler-attachment.cc @@ -304,6 +304,7 @@ gboolean poppler_attachment_save_to_fd(PopplerAttachment *attachment, int fd, GE if (f == nullptr) { int errsv = errno; g_set_error(error, G_FILE_ERROR, g_file_error_from_errno(errsv), _("Failed to open FD %d for writing: %s"), fd, g_strerror(errsv)); + close(fd); return FALSE; } |