discover/resource: create_url_resource should take ownership of url
authorJeremy Kerr <jk@ozlabs.org>
Thu, 26 Sep 2013 03:58:11 +0000 (11:58 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 26 Sep 2013 07:20:59 +0000 (15:20 +0800)
The URL needs to share the lifetime of resource, so talloc_steal it in
create_url_resource.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/resource.c

index 25fff650db7fabc6bfe805525c38c379a3ce7708..f9019d1408eed5556b100140bd9c86437858e7b4 100644 (file)
@@ -122,6 +122,7 @@ struct resource *create_url_resource(struct discover_boot_option *opt,
        struct resource *res;
 
        res = talloc(opt, struct resource);
        struct resource *res;
 
        res = talloc(opt, struct resource);
+       talloc_steal(res, url);
        res->url = url;
        res->resolved = true;
 
        res->url = url;
        res->resolved = true;