]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/rados: fix leaked/unflushed output stream in 'ls'
authorSun Yuechi <sunyuechi@iscas.ac.cn>
Wed, 1 Jul 2026 09:59:15 +0000 (02:59 -0700)
committerSun Yuechi <sunyuechi@iscas.ac.cn>
Wed, 1 Jul 2026 16:46:24 +0000 (09:46 -0700)
`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>
src/tools/rados/rados.cc

index 118359be5823d1cb8b0fecc1232048bcc904e8a3..81ef10f6fd8d6f3020d7e3e334125bbe553ee374 100644 (file)
@@ -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;
     }
   }