From 83ed8e2d6b100cc7247aea88a50772356195200e Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 16 Oct 2006 17:43:20 +0000 Subject: * generic/tclPkg.c (ExactRequirement): Plugged memory leak. Also changed Tcl_Alloc()/Tcl_Free() calls to ckalloc()/ckfree() for easier memory debugging in the future. [Bug 1568373] --- ChangeLog | 4 ++++ generic/tclPkg.c | 9 +++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b5da6d6..78a3b60 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,10 @@ 2006-10-16 Don Porter + * generic/tclPkg.c (ExactRequirement): Plugged memory leak. Also + changed Tcl_Alloc()/Tcl_Free() calls to ckalloc()/ckfree() for easier + memory debugging in the future. [Bug 1568373] + * library/tcltest/tcltest.tcl: Revise tcltest bump to 2.3a1. * library/tcltest/pkgIndex.tcl: This permits more features to be * unix/Makefile.in: added to tcltest before we reach version 2.3.0, diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 029f0b5..ea10e18 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclPkg.c,v 1.20 2006/10/11 20:41:16 dgp Exp $ + * RCS: @(#) $Id: tclPkg.c,v 1.21 2006/10/16 17:43:20 dgp Exp $ * * TIP #268. * Heavily rewritten to handle the extend version numbers, and extended @@ -1218,7 +1218,7 @@ CheckVersionAndConvert( /* 4* assuming that each char is a separator (a,b become ' -x '). * 4+ to have spce for an additional -2 at the end */ - char* ibuf = Tcl_Alloc (4+4*strlen(string)); + char* ibuf = ckalloc (4+4*strlen(string)); char* ip = ibuf; /* Basic rules @@ -1270,7 +1270,7 @@ CheckVersionAndConvert( if (internal != NULL) { *internal = ibuf; } else { - Tcl_Free (ibuf); + ckfree (ibuf); } if (stable != NULL) { *stable = !hasunstable; @@ -1279,7 +1279,7 @@ CheckVersionAndConvert( } error: - Tcl_Free (ibuf); + ckfree (ibuf); Tcl_AppendResult(interp, "expected version number but got \"", string, "\"", NULL); return TCL_ERROR; @@ -1818,6 +1818,7 @@ ExactRequirement(version) sprintf (buf, "%d", atoi (lv [lc-1]) + 1); Tcl_AppendStringsToObj (o, buf, NULL); + ckfree ((char*) iv); ckfree ((char*) lv); return o; } -- cgit v0.12