diff options
| -rw-r--r-- | generic/tclStringObj.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 75b4fdd..258d02b 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2530,12 +2530,18 @@ Tcl_AppendFormatToObj( TclNewObj(segment); allocSegment = 1; if (!Tcl_AttemptSetObjLength(segment, length)) { + if (allocSegment) { + Tcl_DecrRefCount(segment); + } msg = overflow; errCode = "OVERFLOW"; goto errorMsg; } bytes = TclGetString(segment); if (!Tcl_AttemptSetObjLength(segment, snprintf(bytes, segment->length, spec, d))) { + if (allocSegment) { + Tcl_DecrRefCount(segment); + } msg = overflow; errCode = "OVERFLOW"; goto errorMsg; |
