From: Sun Yuechi Date: Wed, 1 Jul 2026 09:59:15 +0000 (-0700) Subject: tools/rados: fix leaked/unflushed output stream in 'ls' X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0ea4eb19b0f1eb234cfb381f79cd0f39bf654adf;p=ceph.git 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 --- diff --git a/src/tools/rados/rados.cc b/src/tools/rados/rados.cc index 118359be5823..81ef10f6fd8d 100644 --- a/src/tools/rados/rados.cc +++ b/src/tools/rados/rados.cc @@ -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; } }