Commit 35feaa96 authored by yan0422.wang's avatar yan0422.wang Committed by Commit bot

Close the file handle before exiting the function

When exiting the function because cannot open "oom_adj" file, not close the file handle "dirfd".

BUG=n/a

Review-Url: https://codereview.chromium.org/2419383008
Cr-Commit-Position: refs/heads/master@{#427018}
parent 8d67cd7a
......@@ -716,6 +716,7 @@ Xuefei Ren <xrenishere@gmail.com>
Xun Sun <xun.sun@intel.com>
Yael Aharon <yael.aharon@intel.com>
Yair Yogev <progame@chromium.org>
Yan Wang <yan0422.wang@samsung.com>
Yang Gu <yang.gu@intel.com>
Yarin Kaul <yarin.kaul@gmail.com>
Ye Liu <cbakgly@gmail.com>
......
......@@ -59,6 +59,7 @@ bool AdjustOOMScore(pid_t process, int score) {
fd = openat(dirfd, "oom_adj", O_WRONLY);
if (fd < 0) {
// Nope, that doesn't work either.
close(dirfd);
return false;
} else {
// If we're using the old oom_adj file, the allowed range is now
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment