OSDN Git Service

Make osi_strdup report allocation size correctly
authorZach Johnson <zachoverflow@google.com>
Thu, 28 Aug 2014 03:26:00 +0000 (20:26 -0700)
committerAndre Eisenbach <eisenbach@google.com>
Mon, 16 Mar 2015 23:51:30 +0000 (16:51 -0700)
osi/src/allocator.c

index c0bf79b..e0b84b8 100644 (file)
@@ -23,7 +23,7 @@
 
 char *osi_strdup(const char *str) {
   char *ret = strdup(str);
-  allocation_tracker_notify_alloc(ret, strlen(ret));
+  allocation_tracker_notify_alloc(ret, strlen(ret) + 1); // + 1 for the null terminator
   return ret;
 }