mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-05 05:39:22 +00:00
Fix resource leaks and minor issues
- Close pipe fds on fork failure in ExecFile::execute - Add exception-safe fclose in cmd_file_append via try/catch - Add overflow guards before K/M/G bit shifts in parse_whole_value - Fix %u format for int* in sscanf (change to %d) - Fix typo "atter"→"after" in error message
This commit is contained in:
@@ -41,8 +41,13 @@ ExecFile::execute(const char* file, char* const* argv, int flags) {
|
||||
|
||||
pid_t childPid = fork();
|
||||
|
||||
if (childPid == -1)
|
||||
if (childPid == -1) {
|
||||
if (flags & flag_capture) {
|
||||
::close(pipeFd[0]);
|
||||
::close(pipeFd[1]);
|
||||
}
|
||||
throw torrent::input_error("ExecFile::execute(...) Fork failed.");
|
||||
}
|
||||
|
||||
if (childPid == 0) {
|
||||
if (flags & flag_background) {
|
||||
|
||||
Reference in New Issue
Block a user