/* free AMF data */ void amf0_data_free(amf0_data * data) { if (data != NULL) { switch (data->type) { case AMF0_TYPE_NUMBER: break; case AMF0_TYPE_BOOLEAN: break; case AMF0_TYPE_STRING: if (data->u.string_data.mbstr) { free(data->u.string_data.mbstr); data->u.string_data.mbstr = NULL; } break; case AMF0_TYPE_NULL: break; case AMF0_TYPE_UNDEFINED: break; /*case AMF0_TYPE_REFERENCE:*/ case AMF0_TYPE_OBJECT: case AMF0_TYPE_ECMA_ARRAY: case AMF0_TYPE_STRICT_ARRAY: amf0_list_clear(&data->u.list_data); break; case AMF0_TYPE_DATE: break; /*case AMF0_TYPE_SIMPLEOBJECT:*/ case AMF0_TYPE_XML_DOCUMENT: break; case AMF0_TYPE_TYPED_OBJECT: break; default: break; } free(data); } }
/* free AMF data */ void amf0_data_free(amf0_data * data) { if (data != NULL) { switch (data->type) { case AMF0_TYPE_NUMBER: break; case AMF0_TYPE_BOOLEAN: break; case AMF0_TYPE_STRING: if (data->string_data.mbstr != NULL) { free(data->string_data.mbstr); } break; case AMF0_TYPE_MOVIECLIP: /* not supported */ case AMF0_TYPE_NULL: case AMF0_TYPE_UNDEFINED: case AMF0_TYPE_REFERENCE: /* TODO */ case AMF0_TYPE_OBJECT_END: break; case AMF0_TYPE_OBJECT: case AMF0_TYPE_ECMA_ARRAY: case AMF0_TYPE_STRICT_ARRAY: amf0_list_clear(&data->list_data); break; case AMF0_TYPE_DATE: break; case AMF0_TYPE_LONG_STRING: /* TODO */ case AMF0_TYPE_UNSUPPORTED: /* TODO */ case AMF0_TYPE_RECORDSET: /* not supported */ case AMF0_TYPE_XML_DOCUMENT: /* TODO */ case AMF0_TYPE_TYPED_OBJECT: /* TODO */ default: break; } free(data); } }