summaryrefslogtreecommitdiffstats
path: root/generic/tclBinary.c
diff options
context:
space:
mode:
authorkennykb <kennykb@noemail.net>2007-04-24 17:18:10 (GMT)
committerkennykb <kennykb@noemail.net>2007-04-24 17:18:10 (GMT)
commitb780bea1bc0770ddd29642006b1ff7b7c81fe776 (patch)
treefc74bc366fbe27ec3df9ec68668340e78d934318 /generic/tclBinary.c
parentca1611930f8b30a32a1454f9479d2c11dd0d9425 (diff)
downloadtcl-b780bea1bc0770ddd29642006b1ff7b7c81fe776.zip
tcl-b780bea1bc0770ddd29642006b1ff7b7c81fe776.tar.gz
tcl-b780bea1bc0770ddd29642006b1ff7b7c81fe776.tar.bz2
* generic/tclBinary.c: Addressed several code paths where the
error return from the 'binary format' command leaked the result buffer. FossilOrigin-Name: ade9d682c6b92e2804221acffe4f0516a00603c9
Diffstat (limited to 'generic/tclBinary.c')
-rw-r--r--generic/tclBinary.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index 485383a..0512739 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.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: tclBinary.c,v 1.34 2007/03/19 21:00:53 dgp Exp $
+ * RCS: @(#) $Id: tclBinary.c,v 1.35 2007/04/24 17:18:11 kennykb Exp $
*/
#include "tclInt.h"
@@ -829,6 +829,7 @@ Tcl_BinaryObjCmd(
value |= 1;
} else if (str[offset] != '0') {
errorValue = str;
+ Tcl_DecrRefCount(resultPtr);
goto badValue;
}
if (((offset + 1) % 8) == 0) {
@@ -843,6 +844,7 @@ Tcl_BinaryObjCmd(
value |= 128;
} else if (str[offset] != '0') {
errorValue = str;
+ Tcl_DecrRefCount(resultPtr);
goto badValue;
}
if (!((offset + 1) % 8)) {
@@ -886,6 +888,7 @@ Tcl_BinaryObjCmd(
value <<= 4;
if (!isxdigit(UCHAR(str[offset]))) { /* INTL: digit */
errorValue = str;
+ Tcl_DecrRefCount(resultPtr);
goto badValue;
}
c = str[offset] - '0';
@@ -907,6 +910,7 @@ Tcl_BinaryObjCmd(
if (!isxdigit(UCHAR(str[offset]))) { /* INTL: digit */
errorValue = str;
+ Tcl_DecrRefCount(resultPtr);
goto badValue;
}
c = str[offset] - '0';
@@ -975,6 +979,7 @@ Tcl_BinaryObjCmd(
arg++;
for (i = 0; i < count; i++) {
if (FormatNumber(interp, cmd, listv[i], &cursor)!=TCL_OK) {
+ Tcl_DecrRefCount(resultPtr);
return TCL_ERROR;
}
}