summaryrefslogtreecommitdiffstats
path: root/generic/tclOOBasic.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2013-08-21 19:00:17 (GMT)
committerdgp <dgp@users.sourceforge.net>2013-08-21 19:00:17 (GMT)
commit88f6a82f096bab2c48289cf27f99c6f2df66da9b (patch)
tree509a52c25398b3ac2a89896d674a104171966338 /generic/tclOOBasic.c
parentb9100f680a4f29439312a01ce54c8340b5d53374 (diff)
downloadtcl-88f6a82f096bab2c48289cf27f99c6f2df66da9b.zip
tcl-88f6a82f096bab2c48289cf27f99c6f2df66da9b.tar.gz
tcl-88f6a82f096bab2c48289cf27f99c6f2df66da9b.tar.bz2
Don't allocate memory until you know you're going to use it and arrange for
it to be freed. Leak!
Diffstat (limited to 'generic/tclOOBasic.c')
-rw-r--r--generic/tclOOBasic.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c
index 073abab..aba06a5 100644
--- a/generic/tclOOBasic.c
+++ b/generic/tclOOBasic.c
@@ -88,7 +88,7 @@ TclOO_Class_Constructor(
Tcl_Obj *const *objv)
{
Object *oPtr = (Object *) Tcl_ObjectContextObject(context);
- Tcl_Obj **invoke = ckalloc(3 * sizeof(Tcl_Obj *));
+ Tcl_Obj **invoke;
if (objc-1 > Tcl_ObjectContextSkippedArgs(context)) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -102,6 +102,7 @@ TclOO_Class_Constructor(
* Delegate to [oo::define] to do the work.
*/
+ invoke = ckalloc(3 * sizeof(Tcl_Obj *));
invoke[0] = oPtr->fPtr->defineName;
invoke[1] = TclOOObjectName(interp, oPtr);
invoke[2] = objv[objc-1];