free (argv);
}
-static int
+static size_t
count_strings (char *const *argv)
{
- int c;
+ size_t i;
- for (c = 0; argv[c]; ++c)
+ for (i = 0; argv[i]; ++i)
;
- return c;
+ return i;
}
static int
if (roots[0] == NULL) {
fprintf (stderr, _("%s: no operating system was found on this disk\n"),
program_name);
+ free_strings (roots);
exit (EXIT_FAILURE);
}
if (roots[1] != NULL) {
fprintf (stderr, _("%s: multi-boot operating systems are not supported by the -i option\n"),
program_name);
+ free_strings (roots);
exit (EXIT_FAILURE);
}
print_inspect_prompt (void)
{
char *name = guestfs_inspect_get_product_name (g, root);
- if (STRNEQ (name, "unknown"))
+ if (name && STRNEQ (name, "unknown"))
printf (_("Operating system: %s\n"), name);
free (name);