diff options
author | rjohnson <rjohnson@noemail.net> | 1999-04-17 02:31:19 (GMT) |
---|---|---|
committer | rjohnson <rjohnson@noemail.net> | 1999-04-17 02:31:19 (GMT) |
commit | 80c31121bdf53517dd3c63b5db2f7754b0321961 (patch) | |
tree | cc6ecd29d7cd888bf00404f4e5cccc2e6406f5c3 | |
parent | 8d61e5b395e26832d149ef01d398825395a0b3f1 (diff) | |
download | tk-80c31121bdf53517dd3c63b5db2f7754b0321961.zip tk-80c31121bdf53517dd3c63b5db2f7754b0321961.tar.gz tk-80c31121bdf53517dd3c63b5db2f7754b0321961.tar.bz2 |
Fixed bug 1790 - memory leak.
FossilOrigin-Name: 0682bc97c6ee875616230d0404a6b52cdeb24692
-rw-r--r-- | generic/tkText.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/generic/tkText.c b/generic/tkText.c index ee19f8a..74181a4 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkText.c,v 1.3 1999/04/16 01:51:23 stanton Exp $ + * RCS: @(#) $Id: tkText.c,v 1.4 1999/04/17 02:31:20 rjohnson Exp $ */ #include "default.h" @@ -1624,8 +1624,10 @@ TextSearchCmd(textPtr, interp, argc, argv) Tcl_UtfToLower(pattern); } + Tcl_DStringInit(&line); if (TkTextGetIndex(interp, textPtr, argv[i+1], &index) != TCL_OK) { - return TCL_ERROR; + code = TCL_ERROR; + goto done; } numLines = TkBTreeNumLines(textPtr->tree); startingLine = TkBTreeLineIndex(index.linePtr); @@ -1642,7 +1644,8 @@ TextSearchCmd(textPtr, interp, argc, argv) } if (argsLeft == 1) { if (TkTextGetIndex(interp, textPtr, argv[i+2], &stopIndex) != TCL_OK) { - return TCL_ERROR; + code = TCL_ERROR; + goto done; } stopLine = TkBTreeLineIndex(stopIndex.linePtr); if (!backwards && (stopLine == numLines)) { @@ -1666,12 +1669,12 @@ TextSearchCmd(textPtr, interp, argc, argv) } else { regexp = Tcl_RegExpCompile(interp, pattern); if (regexp == NULL) { - return TCL_ERROR; + code = TCL_ERROR; + goto done; } } lineNum = startingLine; code = TCL_OK; - Tcl_DStringInit(&line); for (passes = 0; passes < 2; ) { if (lineNum >= numLines) { /* |