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

@@ -1198,6 +1198,15 @@ handle_query :: proc(engine: ^dynamodb.Storage_Engine, request: ^HTTP_Request, r
// Apply ProjectionExpression
projection, has_proj := dynamodb.parse_projection_expression(request.body, attr_names)
defer { // This block just frees the cloned string and projection slice
if has_proj && len(projection) > 0 {
for path in projection {
delete(path) // Free each cloned string
}
delete(projection) // Free the slice
}
}
final_items: []dynamodb.Item
if has_proj && len(projection) > 0 {
@@ -1237,6 +1246,15 @@ handle_query :: proc(engine: ^dynamodb.Storage_Engine, request: ^HTTP_Request, r
// ---- Apply ProjectionExpression ----
projection, has_proj := dynamodb.parse_projection_expression(request.body, attr_names)
defer { // This block just frees the cloned string and projection slice
if has_proj && len(projection) > 0 {
for path in projection {
delete(path) // Free each cloned string
}
delete(projection) // Free the slice
}
}
final_items: []dynamodb.Item
if has_proj && len(projection) > 0 {
@@ -1342,6 +1360,15 @@ handle_scan :: proc(engine: ^dynamodb.Storage_Engine, request: ^HTTP_Request, re
scanned_count := len(result.items)
projection, has_proj := dynamodb.parse_projection_expression(request.body, attr_names)
defer { // This block just frees the cloned string and projection slice
if has_proj && len(projection) > 0 {
for path in projection {
delete(path) // Free each cloned string
}
delete(projection) // Free the slice
}
}
final_items: []dynamodb.Item
if has_proj && len(projection) > 0 {
@@ -1381,6 +1408,15 @@ handle_scan :: proc(engine: ^dynamodb.Storage_Engine, request: ^HTTP_Request, re
// ---- Apply ProjectionExpression ----
projection, has_proj := dynamodb.parse_projection_expression(request.body, attr_names)
defer { // This block just frees the cloned string and projection slice
if has_proj && len(projection) > 0 {
for path in projection {
delete(path) // Free each cloned string
}
delete(projection) // Free the slice
}
}
final_items: []dynamodb.Item
if has_proj && len(projection) > 0 {