[tor-commits] [tor/master] Fix procmon_new to correctly use zeroed memory - otherwise it can blow up if the free call by mistake works on something that is allocated

nickm at torproject.org nickm at torproject.org
Wed Oct 7 13:34:53 UTC 2015


commit 5b43ecf2b3130781b6020615ba7a5b3ddc5509ce
Author: Ola Bini <ola at olabini.se>
Date:   Tue Sep 15 18:44:53 2015 +0200

    Fix procmon_new to correctly use zeroed memory - otherwise it can blow up if the free call by mistake works on something that is allocated
---
 src/common/procmon.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/common/procmon.c b/src/common/procmon.c
index 2d0f021..89c9d75 100644
--- a/src/common/procmon.c
+++ b/src/common/procmon.c
@@ -192,7 +192,7 @@ tor_process_monitor_new(struct event_base *base,
                         tor_procmon_callback_t cb, void *cb_arg,
                         const char **msg)
 {
-  tor_process_monitor_t *procmon = tor_malloc(sizeof(tor_process_monitor_t));
+    tor_process_monitor_t *procmon = tor_malloc_zero(sizeof(tor_process_monitor_t));
   struct parsed_process_specifier_t ppspec;
 
   tor_assert(msg != NULL);
@@ -354,4 +354,3 @@ tor_process_monitor_free(tor_process_monitor_t *procmon)
 
   tor_free(procmon);
 }
-





More information about the tor-commits mailing list