From aba4c796251770f94957f2f7e994cc636a95f3a8 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Mon, 2 Mar 2026 17:36:31 -0500 Subject: [PATCH] fix CCString: clear buffer after use in sprintf fix #487 --- src/core/CCFormat.ml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/CCFormat.ml b/src/core/CCFormat.ml index 3afcf352..a93b29af 100644 --- a/src/core/CCFormat.ml +++ b/src/core/CCFormat.ml @@ -398,7 +398,10 @@ let sprintf_ c format = Format.kfprintf (fun _fmt -> Format.pp_print_flush fmt (); - Buffer.contents buf) + let s = Buffer.contents buf in + Buffer.reset buf; + (* in case of reuse *) + s) fmt format let with_color_ksf ~f s fmt =