static void __bro_val_free(BroVal *val) { D_ENTER; /* If there is no type in the val, then it's unassigned and * hence there won't be anything to clean up anyway. */ if (val->val_type) { switch (val->val_type->tag) { case BRO_TYPE_STRING: bro_string_cleanup(&val->val_str); break; default: /* Nothing to do */ break; } } __bro_sobject_release((BroSObject *) val->val_type); __bro_object_free((BroObject *) val); D_RETURN; }
void __bro_id_free(BroID *id) { D_ENTER; if (!id) D_RETURN; /* First clean up our stuff */ bro_string_cleanup(&id->name); __bro_sobject_release((BroSObject *) id->type); __bro_sobject_release((BroSObject *) id->attrs); __bro_sobject_release((BroSObject *) id->val); /* Then clean up parent -- will eventually call free() */ __bro_object_free((BroObject *) id); D_RETURN; }