static void free_chan(ph_dns_channel_t *chan) { ares_destroy(chan->chan); ph_ht_destroy(&chan->sock_map); pthread_mutex_destroy(&chan->chanlock); ph_mem_free(mt.chan, chan); }
void ph_var_delref(ph_variant_t *var) { if (!ph_refcnt_del(&var->ref)) { return; } switch (var->type) { case PH_VAR_TRUE: case PH_VAR_FALSE: case PH_VAR_NULL: ph_panic("You have a refcounting problem"); case PH_VAR_ARRAY: if (var->u.aval.arr) { uint32_t i; for (i = 0; i < var->u.aval.len; i++) { ph_var_delref(var->u.aval.arr[i]); } ph_mem_free(mt.arr, var->u.aval.arr); var->u.aval.arr = 0; } break; case PH_VAR_OBJECT: ph_ht_destroy(&var->u.oval); break; case PH_VAR_STRING: if (var->u.sval) { ph_string_delref(var->u.sval); var->u.sval = 0; } break; default: ; } ph_mem_free(mt.var, var); }
static void do_hook_fini(void) { #ifdef PH_PLACATE_VALGRIND ph_ht_destroy(&hook_hash); #endif }
static void fini_vprintf(void) { ph_ht_destroy(&formatters); }