aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-04-08 03:05:08 +0000
committerNick Mathewson <nickm@torproject.org>2004-04-08 03:05:08 +0000
commit024c059fae2eb7bab2bc8b50cc7b5afccae34916 (patch)
tree76be5ae6b61c21e4574fd62ff3ce9bcd7bc4fcbd /src/common/util.c
parent40f7324eeae8886e76b7b28ad4d175369a3d6fb5 (diff)
downloadtor-024c059fae2eb7bab2bc8b50cc7b5afccae34916.tar
tor-024c059fae2eb7bab2bc8b50cc7b5afccae34916.tar.gz
Force tor_malloc(0) to always be sane
svn:r1558
Diffstat (limited to 'src/common/util.c')
-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) {