mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 15:43:32 +01:00
add a tor_malloc_zero wrapper: tor_malloc and memset 0
svn:r836
This commit is contained in:
parent
a3e39b0ceb
commit
ec02f83f94
@ -25,6 +25,12 @@ void *tor_malloc(size_t size) {
|
|||||||
return result;
|
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 *tor_realloc(void *ptr, size_t size) {
|
||||||
void *result;
|
void *result;
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void *tor_malloc(size_t size);
|
void *tor_malloc(size_t size);
|
||||||
|
void *tor_malloc_zero(size_t size);
|
||||||
void *tor_realloc(void *ptr, size_t size);
|
void *tor_realloc(void *ptr, size_t size);
|
||||||
char *tor_strdup(const char *s);
|
char *tor_strdup(const char *s);
|
||||||
#define tor_free(p) do {if(p) {free(p); (p)=NULL;}} while(0)
|
#define tor_free(p) do {if(p) {free(p); (p)=NULL;}} while(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user