diff options
author | rjohnson <rjohnson> | 1999-04-17 02:31:20 (GMT) |
---|---|---|
committer | rjohnson <rjohnson> | 1999-04-17 02:31:20 (GMT) |
commit | f6578ca565864599b061ed0ce8243adaa213e987 (patch) | |
tree | cc6ecd29d7cd888bf00404f4e5cccc2e6406f5c3 /generic/tkText.c | |
parent | aa98b53a53f5565dca97b25a012ca3d77f83531c (diff) | |
download | tk-f6578ca565864599b061ed0ce8243adaa213e987.zip tk-f6578ca565864599b061ed0ce8243adaa213e987.tar.gz tk-f6578ca565864599b061ed0ce8243adaa213e987.tar.bz2 |
Fixed bug 1790 - memory leak.
Diffstat (limited to 'generic/tkText.c')
-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) { /* |