mirror of
https://github.com/ceph/ceph
synced 2026-08-01 22:45:39 +00:00
tools/rados: fix leaked/unflushed output stream in 'ls'
`if (!stdout)` tested the libc FILE* (never null) instead of the use_stdout flag, so the ofstream was never deleted when writing to a file, leaking it and leaving its buffer unflushed. Test use_stdout. Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
This commit is contained in:
parent
ef0b9f339f
commit
0ea4eb19b0
@ -2581,7 +2581,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
||||
}
|
||||
formatter->flush(*outstream);
|
||||
}
|
||||
if (!stdout) {
|
||||
if (!use_stdout) {
|
||||
delete outstream;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user