summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-09-26 11:44:33 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-09-26 15:20:59 +0800
commit8ad9aba4b4463c9231eb441c81694686443b011a (patch)
tree9e2df7980f2c7247ea00e554ab1fcc0a1e505354 /lib
parent384d406380d8bf164ed2ca3879488cc4974239be (diff)
downloadtalos-petitboot-8ad9aba4b4463c9231eb441c81694686443b011a.tar.gz
talos-petitboot-8ad9aba4b4463c9231eb441c81694686443b011a.zip
lib/url: talloc from new URL in pb_url_copy
We're ending up with members of new_url being allocated from the old URL's context. We should be tallocing from the new_url instead. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/url/url.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/url/url.c b/lib/url/url.c
index 6d1004f..8a3d0db 100644
--- a/lib/url/url.c
+++ b/lib/url/url.c
@@ -254,13 +254,13 @@ static struct pb_url *pb_url_copy(void *ctx, const struct pb_url *url)
new_url = talloc(ctx, struct pb_url);
new_url->scheme = url->scheme;
- new_url->full = talloc_strdup(url, url->full);
+ new_url->full = talloc_strdup(new_url, url->full);
- new_url->host = url->host ? talloc_strdup(url, url->host) : NULL;
- new_url->port = url->port ? talloc_strdup(url, url->port) : NULL;
- new_url->path = url->path ? talloc_strdup(url, url->path) : NULL;
- new_url->dir = url->dir ? talloc_strdup(url, url->dir) : NULL;
- new_url->file = url->file ? talloc_strdup(url, url->file) : NULL;
+ new_url->host = url->host ? talloc_strdup(new_url, url->host) : NULL;
+ new_url->port = url->port ? talloc_strdup(new_url, url->port) : NULL;
+ new_url->path = url->path ? talloc_strdup(new_url, url->path) : NULL;
+ new_url->dir = url->dir ? talloc_strdup(new_url, url->dir) : NULL;
+ new_url->file = url->file ? talloc_strdup(new_url, url->file) : NULL;
return new_url;
}
OpenPOWER on IntegriCloud