Bug 820652 (part 7) - DMD: Fix bug in strdup_. r=jlebar.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 12 Dec 2012 21:57:23 -0800
changeset 116010 8c77de31ddc4e93faed739de65073c5ff96f6bf8
parent 116009 9f305729255b0b2df0ca04e03d1774b7f2724a64
child 116011 e66d60ed300042c010b483f554a5383690096f43
push id24034
push useremorley@mozilla.com
push dateFri, 14 Dec 2012 15:28:57 +0000
treeherdermozilla-central@50d8f411d305 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlebar
bugs820652
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 820652 (part 7) - DMD: Fix bug in strdup_. r=jlebar.
memory/replace/dmd/DMD.cpp
--- a/memory/replace/dmd/DMD.cpp
+++ b/memory/replace/dmd/DMD.cpp
@@ -119,17 +119,17 @@ public:
     ExitOnFailure(p);
     return p;
   }
 
   static void free_(void* aPtr) { gMallocTable->free(aPtr); }
 
   static char* strdup_(const char* aStr)
   {
-    char* s = (char*) gMallocTable->malloc(strlen(aStr));
+    char* s = (char*) gMallocTable->malloc(strlen(aStr) + 1);
     ExitOnFailure(s);
     strcpy(s, aStr);
     return s;
   }
 
   template <class T>
   static T* new_()
   {