Skip to content
Snippets Groups Projects
Commit 94ca7d27 authored by hangl's avatar hangl Committed by Dhina17
Browse files

Fix pipe fds leak in copyInternalSpliceSocket

This method used a temporarily pipe to copy data but forget to close it
before exiting, which will cause fd leak. As the number of times this
method is called increases, the process may abort since the fd reaches
its limit. So close the pipe before exiting.

Bug: 344767008
Change-Id: I2028bf2e36e9dde9b6aaea1f7c758169e6842cc7
parent cd1aaf65
No related branches found
No related tags found
No related merge requests found
......@@ -580,6 +580,8 @@ public final class FileUtils {
", copied:" + progress +
", read:" + (count - countToRead) +
", in pipe: " + countInPipe);
Os.close(pipes[0]);
Os.close(pipes[1]);
throw new ErrnoException("splice, pipe --> fdOut", EIO);
} else {
progress += t;
......@@ -607,6 +609,8 @@ public final class FileUtils {
listener.onProgress(progressSnapshot);
});
}
Os.close(pipes[0]);
Os.close(pipes[1]);
return progress;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment