Browse Source

Force tor_malloc(0) to always be sane

svn:r1558
Nick Mathewson 20 years ago
parent
commit
024c059fae
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/common/util.c

+ 4 - 0
src/common/util.c

@@ -69,6 +69,10 @@
 void *tor_malloc(size_t size) {
   void *result;
 
+  /* Some libcs don't do the right thing on size==0. Override them. */
+  if (size==0) {
+    size=1;
+  }
   result = malloc(size);
 
   if(!result) {