[tor-commits] [tor/master] replaced malloc/free with tor_malloc/tor_free

nickm at torproject.org nickm at torproject.org
Fri Sep 13 16:31:56 UTC 2013


commit 2a6c34750d1723382e0342333ef9a15785adaf66
Author: Cristian Toader <cristian.matei.toader at gmail.com>
Date:   Fri Sep 6 12:29:15 2013 +0300

    replaced malloc/free with tor_malloc/tor_free
---
 src/common/sandbox.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/common/sandbox.c b/src/common/sandbox.c
index b4189b5..0c2145f 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;





More information about the tor-commits mailing list