mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-07 18:52:30 +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:
@@ -173,9 +173,13 @@ cmd_file_append(const torrent::Object::list_type& args) {
|
||||
if (output == nullptr)
|
||||
throw torrent::input_error("Could not append to file '" + args.front().as_string() + "': " + std::strerror(errno));
|
||||
|
||||
file_print_list(++args.begin(), args.end(), output, file_print_delim_space);
|
||||
|
||||
fprintf(output, "\n");
|
||||
try {
|
||||
file_print_list(++args.begin(), args.end(), output, file_print_delim_space);
|
||||
fprintf(output, "\n");
|
||||
} catch (...) {
|
||||
fclose(output);
|
||||
throw;
|
||||
}
|
||||
fclose(output);
|
||||
return torrent::Object();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user