[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH] NFC: Cleanup iteration over fstab entries in inspect_fs_unix.c

On Thu, Nov 24, 2011 at 02:48:46PM +0000, Matthew Booth wrote:
> Select non-comment labels using an augeas path to return the correct nodes in
> the first instance, rather than applying a regular expression to all results.
> Iterate over returned matches using a char** iterator.
> Use asprintf() to ensure the path string buffer is the correct size.

In general this is an obvious improvement.

> +  for (char **entry = entries; *entry != NULL; entry++) {
> +    if (asprintf (&augpath, "%s/spec", *entry) == -1) g->abort_cb();

We have a safe_asprintf function defined already, and it would be
better to use that.

Is augpath supposed to be freed on the non-error path?

spec and mp should be freed on the error path, but don't seem to be at
the moment.


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]