Subject: [Bug 3496014]: Unecessary memset() in Tcl_SetByteArrayObj()

From: "jan.nijtmans" <[email-masked]>
Date: Mon, 16 Jul 2012 20:31:44 +0000

---
 generic/tclBinary.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index 444e7fa..ae8172f 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.c
@@ -307,12 +307,8 @@ Tcl_SetByteArrayObj(
     byteArrayPtr = ckalloc(BYTEARRAY_SIZE(length));
     byteArrayPtr->used = length;
     byteArrayPtr->allocated = length;
-    if (length) {
-	if (bytes) {
-	    memcpy(byteArrayPtr->bytes, bytes, (size_t) length);
-	} else {
-	    memset(byteArrayPtr->bytes, 0, (size_t) length);
-	}
+    if (length && bytes) {
+	memcpy(byteArrayPtr->bytes, bytes, (size_t) length);
     }
 
     objPtr->typePtr = &tclByteArrayType;
-- 
cgit v0.12