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 =