diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/util.c | 6 | ||||
-rw-r--r-- | src/common/util.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c index d8adc05f3d..24c9902034 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -25,6 +25,12 @@ void *tor_malloc(size_t size) { return result; } +void *tor_malloc_zero(size_t size) { + void *result = tor_malloc(size); + memset(result, 0, size); + return result; +} + void *tor_realloc(void *ptr, size_t size) { void *result; diff --git a/src/common/util.h b/src/common/util.h index f1c744b01b..8e91532ba0 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -33,6 +33,7 @@ #endif void *tor_malloc(size_t size); +void *tor_malloc_zero(size_t size); void *tor_realloc(void *ptr, size_t size); char *tor_strdup(const char *s); #define tor_free(p) do {if(p) {free(p); (p)=NULL;}} while(0) |