free clones via delete instead of free
This commit is contained in:
36
main.odin
36
main.odin
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user