free clones via delete instead of free

This commit is contained in:
2026-02-16 03:11:11 -05:00
parent 2b04e29331
commit 06ed6a2c97
3 changed files with 45 additions and 4 deletions

View File

@@ -32,6 +32,7 @@ Sort_Key_Condition :: struct {
}
sort_key_condition_destroy :: proc(skc: ^Sort_Key_Condition) {
delete(skc.sk_name) // Free the cloned string
attr_value_destroy(&skc.value)
if v2, ok := skc.value2.?; ok {
v2_copy := v2
@@ -46,6 +47,7 @@ Key_Condition :: struct {
}
key_condition_destroy :: proc(kc: ^Key_Condition) {
delete(kc.pk_name) // Free the cloned string
attr_value_destroy(&kc.pk_value)
if skc, ok := kc.sk_condition.?; ok {
skc_copy := skc
@@ -166,7 +168,8 @@ parse_key_condition_expression :: proc(
t := tokenizer_init(expression)
pk_name_token := next_token(&t) or_return
pk_name := resolve_attribute_name(pk_name_token, attribute_names) or_return
pk_name_unowned := resolve_attribute_name(pk_name_token, attribute_names) or_return
pk_name := strings.clone(pk_name_unowned) // Clone for safe storage
eq_token := next_token(&t) or_return
if eq_token != "=" {
@@ -219,7 +222,8 @@ parse_sort_key_condition :: proc(
return
}
sk_name := resolve_attribute_name(first_token, attribute_names) or_return
sk_name_unowned := resolve_attribute_name(first_token, attribute_names) or_return
sk_name := strings.clone(sk_name_unowned) // Clone for safe storage
op_token := next_token(t) or_return
operator, op_ok := parse_operator(op_token)
@@ -278,7 +282,8 @@ parse_begins_with :: proc(
}
sk_name_token := next_token(t) or_return
sk_name := resolve_attribute_name(sk_name_token, attribute_names) or_return
sk_name_unowned := resolve_attribute_name(sk_name_token, attribute_names) or_return
sk_name := strings.clone(sk_name_unowned) // Clone for safe storage
comma := next_token(t) or_return
if comma != "," {

View File

@@ -54,7 +54,7 @@ parse_projection_expression :: proc(
delete(result)
return nil, false
}
append(&result, resolved)
append(&result, strings.clone(resolved)) // Clone for safe storage
}
return result[:], true