summaryrefslogtreecommitdiffstats
path: root/generic/tclBinary.c
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2007-04-24 17:18:10 (GMT)
committerKevin B Kenny <kennykb@acm.org>2007-04-24 17:18:10 (GMT)
commitdc4a6bd185824428dbdbeb43e9ef2888dd8da7c8 (patch)
treefc74bc366fbe27ec3df9ec68668340e78d934318 /generic/tclBinary.c
parent877bccfda97bb0128ba071241fea5911def1448b (diff)
downloadtcl-dc4a6bd185824428dbdbeb43e9ef2888dd8da7c8.zip
tcl-dc4a6bd185824428dbdbeb43e9ef2888dd8da7c8.tar.gz
tcl-dc4a6bd185824428dbdbeb43e9ef2888dd8da7c8.tar.bz2
* generic/tclBinary.c: Addressed several code paths where the
error return from the 'binary format' command leaked the result buffer.
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;
}
}