aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--url.ha6
1 files changed, 2 insertions, 4 deletions
diff --git a/url.ha b/url.ha
index 6c4ef79..1c511ba 100644
--- a/url.ha
+++ b/url.ha
@@ -4,7 +4,7 @@
use strings;
use net::uri;
-// The result must be freed with strings::freeall.
+// The result, if not erroring out, must be freed with strings::freeall.
fn segments_from_path(s: str) ([]str | nomem | uri::invalid) = {
let sp: []str = strings::split(s, "/")?;
for (let i = 1z; i < len(sp); i += 1) {
@@ -12,9 +12,7 @@ fn segments_from_path(s: str) ([]str | nomem | uri::invalid) = {
case let s: str =>
sp[i - 1] = s;
case uri::invalid =>
- for (let j = 0z; j < i - 1; j += 1) {
- free(sp[j]);
- };
+ strings::freeall(sp[.. i - 1]);
return uri::invalid;
};
};