diff options
| author | donal.k.fellows@manchester.ac.uk <dkf> | 2007-06-30 13:56:22 (GMT) |
|---|---|---|
| committer | donal.k.fellows@manchester.ac.uk <dkf> | 2007-06-30 13:56:22 (GMT) |
| commit | 308961c1031842603691c32820684692e94fbfcf (patch) | |
| tree | d5928573428ce5602e49de786256ed95ab59a100 /generic/tclBinary.c | |
| parent | 7871c651d680d4cc210fde8a6d406ef32c9490a4 (diff) | |
| download | tcl-308961c1031842603691c32820684692e94fbfcf.zip tcl-308961c1031842603691c32820684692e94fbfcf.tar.gz tcl-308961c1031842603691c32820684692e94fbfcf.tar.bz2 | |
De-fang an instance of the shared-result anti-pattern. [Bug 1716704]
Diffstat (limited to 'generic/tclBinary.c')
| -rw-r--r-- | generic/tclBinary.c | 6 |
1 files changed, 5 insertions, 1 deletions
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); |
