summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2011-08-04 13:16:22 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2011-08-04 13:16:22 (GMT)
commit277d2c7075ce7dee345ae755f48675378a04edc2 (patch)
tree5be866fb0c0f23fc5056a35a31e6aa2fa468f9cd /generic
parentd82fd277a100d2f7d8297003c6aeae4cef56a6fa (diff)
downloadtcl-277d2c7075ce7dee345ae755f48675378a04edc2.zip
tcl-277d2c7075ce7dee345ae755f48675378a04edc2.tar.gz
tcl-277d2c7075ce7dee345ae755f48675378a04edc2.tar.bz2
[Bug 3384840]: Fix memory leaks in the assembler due to Tcl_Obj reference
ownership error.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclAssembly.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index 1b87886..e12d0f8 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -1244,8 +1244,6 @@ AssembleOneLine(
*/
tokenPtr = parsePtr->tokenPtr;
- instNameObj = Tcl_NewObj();
- Tcl_IncrRefCount(instNameObj);
if (GetNextOperand(assemEnvPtr, &tokenPtr, &instNameObj) != TCL_OK) {
return TCL_ERROR;
}
@@ -2087,17 +2085,14 @@ GetBooleanOperand(
Tcl_Token* tokenPtr = *tokenPtrPtr;
/* INOUT: Pointer to the next token in the
* source code */
- Tcl_Obj* intObj = Tcl_NewObj();
- /* Integer from the source code */
+ Tcl_Obj* intObj; /* Integer from the source code */
int status; /* Tcl status return */
/*
* Extract the next token as a string.
*/
- Tcl_IncrRefCount(intObj);
if (GetNextOperand(assemEnvPtr, tokenPtrPtr, &intObj) != TCL_OK) {
- Tcl_DecrRefCount(intObj);
return TCL_ERROR;
}
@@ -2143,17 +2138,14 @@ GetIntegerOperand(
Tcl_Token* tokenPtr = *tokenPtrPtr;
/* INOUT: Pointer to the next token in the
* source code */
- Tcl_Obj* intObj = Tcl_NewObj();
- /* Integer from the source code */
+ Tcl_Obj* intObj; /* Integer from the source code */
int status; /* Tcl status return */
/*
* Extract the next token as a string.
*/
- Tcl_IncrRefCount(intObj);
if (GetNextOperand(assemEnvPtr, tokenPtrPtr, &intObj) != TCL_OK) {
- Tcl_DecrRefCount(intObj);
return TCL_ERROR;
}
@@ -2199,17 +2191,14 @@ GetListIndexOperand(
Tcl_Token* tokenPtr = *tokenPtrPtr;
/* INOUT: Pointer to the next token in the
* source code */
- Tcl_Obj* intObj = Tcl_NewObj();
- /* Integer from the source code */
+ Tcl_Obj* intObj; /* Integer from the source code */
int status; /* Tcl status return */
/*
* Extract the next token as a string.
*/
- Tcl_IncrRefCount(intObj);
if (GetNextOperand(assemEnvPtr, tokenPtrPtr, &intObj) != TCL_OK) {
- Tcl_DecrRefCount(intObj);
return TCL_ERROR;
}
@@ -2256,15 +2245,12 @@ FindLocalVar(
Tcl_Token* tokenPtr = *tokenPtrPtr;
/* INOUT: Pointer to the next token
* in the source code */
- Tcl_Obj* varNameObj = Tcl_NewObj();
- /* Name of the variable */
+ Tcl_Obj* varNameObj; /* Name of the variable */
const char* varNameStr;
int varNameLen;
int localVar; /* Index of the variable in the LVT */
- Tcl_IncrRefCount(varNameObj);
if (GetNextOperand(assemEnvPtr, tokenPtrPtr, &varNameObj) != TCL_OK) {
- Tcl_DecrRefCount(varNameObj);
return -1;
}
varNameStr = Tcl_GetStringFromObj(varNameObj, &varNameLen);