From: Cristian Toader Date: Fri, 6 Sep 2013 09:29:15 +0000 (+0300) Subject: replaced malloc/free with tor_malloc/tor_free X-Git-Tag: tor-0.2.5.1-alpha~39^2~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a6c34750d1723382e0342333ef9a15785adaf66;p=thirdparty%2Ftor.git replaced malloc/free with tor_malloc/tor_free --- diff --git a/src/common/sandbox.c b/src/common/sandbox.c index b4189b5df6..0c2145f846 100644 --- a/src/common/sandbox.c +++ b/src/common/sandbox.c @@ -728,7 +728,7 @@ prot_strings(sandbox_cfg_t* cfg) memcpy(pr_mem_next, param_val, param_size); // re-point el parameter to protected - free((char*) ((smp_param_t*)el->param)->value); + tor_free((char*) ((smp_param_t*)el->param)->value); ((smp_param_t*)el->param)->value = (intptr_t) pr_mem_next; ((smp_param_t*)el->param)->prot = 1; @@ -759,13 +759,13 @@ new_element(int syscall, int index, intptr_t value) { smp_param_t *param = NULL; - sandbox_cfg_t *elem = (sandbox_cfg_t*) malloc(sizeof(sandbox_cfg_t)); + sandbox_cfg_t *elem = (sandbox_cfg_t*) tor_malloc(sizeof(sandbox_cfg_t)); if (!elem) return NULL; - elem->param = (smp_param_t*) malloc(sizeof(smp_param_t)); + elem->param = (smp_param_t*) tor_malloc(sizeof(smp_param_t)); if (!elem->param) { - free(elem); + tor_free(elem); return NULL; } @@ -793,7 +793,7 @@ sandbox_cfg_allow_stat64_filename(sandbox_cfg_t **cfg, char *file, int fr) elem->next = *cfg; *cfg = elem; - if (fr) tor_free_(file); + if (fr) tor_free(file); return 0; } @@ -836,7 +836,7 @@ sandbox_cfg_allow_open_filename(sandbox_cfg_t **cfg, char *file, int fr) elem->next = *cfg; *cfg = elem; - if (fr) tor_free_(file); + if (fr) tor_free(file); return 0; } @@ -879,7 +879,7 @@ sandbox_cfg_allow_openat_filename(sandbox_cfg_t **cfg, char *file, int fr) elem->next = *cfg; *cfg = elem; - if (fr) tor_free_(file); + if (fr) tor_free(file); return 0; } @@ -958,7 +958,7 @@ sandbox_getaddrinfo(const char *name, struct addrinfo hints, for (el = sb_addr_info; el; el = el->next) { if (!strcmp(el->name, name)) { - *res = (struct addrinfo *) malloc(sizeof(struct addrinfo)); + *res = (struct addrinfo *) tor_malloc(sizeof(struct addrinfo)); if (!res) { return -2; } @@ -980,7 +980,7 @@ sandbox_getaddrinfo(const char *name, struct addrinfo hints, // getting here means something went wrong log_err(LD_BUG,"(Sandbox) failed to get address %s!", name); if (*res) { - free(*res); + tor_free(*res); res = NULL; } return -1; @@ -993,7 +993,7 @@ sandbox_add_addrinfo(const char* name) struct addrinfo hints; sb_addr_info_t *el = NULL; - el = (sb_addr_info_t*) malloc(sizeof(sb_addr_info_t)); + el = (sb_addr_info_t*) tor_malloc(sizeof(sb_addr_info_t)); if (!el) { log_err(LD_BUG,"(Sandbox) failed to allocate addr info!"); ret = -2;