summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHobin Woo <hobin.woo@samsung.corp-partner.google.com>2022-11-07 21:16:51 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-11-07 21:16:51 +0000
commita1e2858cb842b473b6ac98bb499a15aafaae0f36 (patch)
tree924be72429297471fba997e9202c69c046364af6
parenta29eb594b9f38f1bc4cff3cde27ea97f90c9beb8 (diff)
parentce87de0d5a7ce15280cd544fd66bae128dc9ec9b (diff)
downloadincremental_delivery-a1e2858cb842b473b6ac98bb499a15aafaae0f36.tar.gz
Fix file descriptor leak on IncFS v1 am: 4d2d129f2b am: 2346524072 am: ce87de0d5a
Original change: https://android-review.googlesource.com/c/platform/system/incremental_delivery/+/2289234 Change-Id: I1eba213f3789f2c62a3da9ba9e808b0df1168a77 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--incfs/incfs.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/incfs/incfs.cpp b/incfs/incfs.cpp
index e13cd81..29574c1 100644
--- a/incfs/incfs.cpp
+++ b/incfs/incfs.cpp
@@ -1611,7 +1611,8 @@ IncFsErrorCode IncFs_IsFullyLoadedByPath(const IncFsControl* control, const char
}
return isFullyLoadedV2(root, id);
}
- return isFullyLoadedSlow(openForSpecialOps(control->cmd, makeCommandPath(root, path).c_str()));
+ auto fd = ab::unique_fd(openForSpecialOps(control->cmd, makeCommandPath(root, path).c_str()));
+ return isFullyLoadedSlow(fd.get());
}
IncFsErrorCode IncFs_IsFullyLoadedById(const IncFsControl* control, IncFsFileId fileId) {
if (!control) {
@@ -1624,9 +1625,10 @@ IncFsErrorCode IncFs_IsFullyLoadedById(const IncFsControl* control, IncFsFileId
if (features() & Features::v2) {
return isFullyLoadedV2(root, fileId);
}
- return isFullyLoadedSlow(
+ auto fd = ab::unique_fd(
openForSpecialOps(control->cmd,
makeCommandPath(root, indexPath(root, fileId)).c_str()));
+ return isFullyLoadedSlow(fd.get());
}
static IncFsErrorCode isEverythingLoadedV2(const IncFsControl* control) {