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; }
static int __bro_mutable_val_read(BroMutableVal *mv, BroConn *bc) { BroString tmp; D_ENTER; bro_string_init(&tmp); if (! __bro_val_read((BroVal *) mv, bc)) D_RETURN_(FALSE); if (! __bro_buf_read_char(bc->rx_buf, &mv->props)) D_RETURN_(FALSE); if (! __bro_buf_read_string(bc->rx_buf, &tmp)) D_RETURN_(FALSE); /* FIXME: now need to obtain real BroID from that name */ bro_string_cleanup(&tmp); D_RETURN_(TRUE); }