[ostree] repo: Fix file descriptor leak from previous commit
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] repo: Fix file descriptor leak from previous commit
- Date: Sun, 8 Sep 2013 14:41:47 +0000 (UTC)
commit 75225166daf37b6f7acd6a333a14c33f4dd69fc4
Author: Colin Walters <walters verbum org>
Date: Sun Sep 8 10:41:18 2013 -0400
repo: Fix file descriptor leak from previous commit
I keep forgetting mmap doesn't take ownership of the fd.
src/libostree/ostree-repo.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index bb52798..1a7dbce 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -827,7 +827,8 @@ load_metadata_internal (OstreeRepo *self,
mfile = g_mapped_file_new_from_fd (fd, FALSE, error);
if (!mfile)
goto out;
- fd = -1; /* Transfer ownership */
+ (void) close (fd); /* Ignore errors, we have it mapped */
+ fd = -1;
ret_variant = g_variant_new_from_data (ostree_metadata_variant_type (objtype),
g_mapped_file_get_contents (mfile),
g_mapped_file_get_length (mfile),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]