aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/util.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 935aadea9..c5dd6aa97 100644
--- a/src/common/util.c
+++ b/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) {