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

This commit is contained in:
Ola Bini 2015-09-15 18:44:53 +02:00
parent b4950c9334
commit 5b43ecf2b3
No known key found for this signature in database
GPG Key ID: 465757AF3914B4B7

View File

@ -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);
}