Bug 820652 (part 7) - DMD: Fix bug in strdup_. r+a=jlebar
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 12 Dec 2012 21:57:23 -0800
changeset 118911 070bb9a35fa97d5c72dd0e57bf1a847e0e18333d
parent 118910 dfe6d957629116beb1a6f6ba0c14ecfbf80848f0
child 118912 1009e22289f263cf81a21e5abd8ef34d2f8a50fa
push id2984
push userryanvm@gmail.com
push dateTue, 18 Dec 2012 03:08:28 +0000
treeherdermozilla-aurora@68ae24dc739c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs820652
milestone19.0a2
Bug 820652 (part 7) - DMD: Fix bug in strdup_. r+a=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_()
   {