Skip to content

Commit c52111f

Browse files
committed
Call ada_free_strings in URLSearchParams.get_all
1 parent c5cd794 commit c52111f

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

ada_url/ada_adapter.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,14 +395,16 @@ def get(self, key: str) -> str:
395395
return _get_str(item)
396396

397397
def get_all(self, key: str) -> List[str]:
398+
ret = []
398399
key_bytes = key.encode()
399400
items = lib.ada_search_params_get_all(self.paramsobj, key_bytes, len(key_bytes))
400-
count = lib.ada_strings_size(items)
401-
402-
ret = []
403-
for i in range(count):
404-
value = _get_str(lib.ada_strings_get(items, i))
405-
ret.append(value)
401+
try:
402+
count = lib.ada_strings_size(items)
403+
for i in range(count):
404+
value = _get_str(lib.ada_strings_get(items, i))
405+
ret.append(value)
406+
finally:
407+
lib.ada_free_strings(items)
406408

407409
return ret
408410

0 commit comments

Comments
 (0)