]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
String 'call duplication' optimization(?) bypassed calling String::init()
authorrousskov <>
Thu, 24 Jan 2008 02:24:14 +0000 (02:24 +0000)
committerrousskov <>
Thu, 24 Jan 2008 02:24:14 +0000 (02:24 +0000)
when copying a String and called limitInit() directly. That results in
an assertion when an empty String is copied. The fix avoids calling
limitInit() when an empty String is copied.

src/String.cc

index 9da75947b7764315f963209382ca981517d8232f..7dc48a694cb1dd97b2309b535976a040b4a633d4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: String.cc,v 1.27 2008/01/23 03:06:20 amosjeffries Exp $
+ * $Id: String.cc,v 1.28 2008/01/23 19:24:14 rousskov Exp $
  *
  * DEBUG: section 67    String
  * AUTHOR: Duane Wessels
@@ -119,7 +119,8 @@ String::limitInit(const char *str, int len)
 
 String::String (String const &old) : size_(0), len_(0), buf_(NULL)
 {
-    limitInit(old.buf(), old.size());
+    if (old.size() > 0)
+        limitInit(old.buf(), old.size());
 #if DEBUGSTRINGS
 
     StringRegistry::Instance().add(this);