summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2007-06-30 13:56:22 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2007-06-30 13:56:22 (GMT)
commit699e0abdd1f9687bdda33420a941f8217d88c18c (patch)
treed5928573428ce5602e49de786256ed95ab59a100
parent39f3fb41532e9e33414f8e35c50aad670e98d0e2 (diff)
downloadtcl-699e0abdd1f9687bdda33420a941f8217d88c18c.zip
tcl-699e0abdd1f9687bdda33420a941f8217d88c18c.tar.gz
tcl-699e0abdd1f9687bdda33420a941f8217d88c18c.tar.bz2
De-fang an instance of the shared-result anti-pattern. [Bug 1716704]
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclBinary.c6
2 files changed, 10 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index dcd80cf..b90b807 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-06-30 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tclBinary.c (Tcl_BinaryObjCmd): De-fang an instance of the
+ shared-result anti-pattern. [Bug 1716704]
+
2007-06-30 Zoran Vasiljevic <vasiljevic@users.sourceforge.net>
* generic/tclThread.c: Prevent RemeberSyncObj() from growing the sync
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index fcc0061..b5bd3ff 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.13.2.4 2005/10/23 22:01:29 msofer Exp $
+ * RCS: @(#) $Id: tclBinary.c,v 1.13.2.5 2007/06/30 13:56:23 dkf Exp $
*/
#include "tclInt.h"
@@ -771,6 +771,10 @@ Tcl_BinaryObjCmd(dummy, interp, objc, objv)
*/
resultPtr = Tcl_GetObjResult(interp);
+ if (Tcl_IsShared(resultPtr)) {
+ TclNewObj(resultPtr);
+ Tcl_SetObjResult(interp, resultPtr);
+ }
buffer = Tcl_SetByteArrayLength(resultPtr, length);
memset((VOID *) buffer, 0, (size_t) length);