[PATCH 05/14] discover/grub2: expose a struct for grub2 file references
Jeremy Kerr
jk at ozlabs.org
Mon Dec 2 17:15:09 AEDT 2019
Hi Sam,
> > @@ -55,13 +50,12 @@ struct resource *create_grub2_resource(struct
> > discover_boot_option *opt,
> > res = talloc(opt, struct resource);
> >
> > if (root) {
> > - info = talloc(res, struct grub2_resource_info);
> > - talloc_reference(info, root);
> > - info->root = talloc_strdup(info, root);
> > - info->path = talloc_strdup(info, path);
> > + file = talloc(res, struct grub2_file);
> > + file->dev = talloc_strdup(file, root);
> > + file->path = talloc_strdup(file, path);
>
> Should be fine I think but caught my eye; do we lose anything by
> dropping that talloc_reference()?
That wasn't needed in the first place - since we talloc_strdup() root,
we never needed an additional reference to it. It looks like I should
have removed that in 1513dd5d0, where we changed from using the root var
to the strdup.
Cheers,
Jeremy
More information about the Petitboot
mailing list