A string-returning function, method or property getter used DIRECTLY as a
Write/WriteLn argument — WriteLn(GetBar) — returns a fresh +1 string that
_SysWriteStr only borrows. EmitWrite emitted the write call but never released
that transient, leaking one string per call on BOTH backends. (A normal
procedure's const-string parameter already released it; only the Write/WriteLn
built-in path was missing the release. Assigning the result to a variable
first never leaked.)
EmitWrite now releases the string argument after the write when the argument
expression OWNS its reference (ExprOwnsRef / NativeExprOwnsRef) — a call or
concat result. Plain variables, literals and PChars are borrowed and are not
released, so no double-free. Native stashes the pointer across the
_SysWriteStr call and releases it after.
E2E regression (both backends, --debug leak tracker):
TE2ELeakCheckTests.TestDebug_WriteLnCallArg_NoLeak.