util/setup: fix grub_util_path_list leak

Add helper grub_util_free_path_list and use it where appropriate.

Found by: Coverity scan.
CID: 73727
This commit is contained in:
Andrei Borzenkov 2016-01-09 13:28:42 +03:00
parent 57e7f1b775
commit 0e075ac385
4 changed files with 19 additions and 8 deletions

View file

@ -271,3 +271,17 @@ grub_util_resolve_dependencies (const char *prefix,
return prev;
}
}
void
grub_util_free_path_list (struct grub_util_path_list *path_list)
{
struct grub_util_path_list *next;
while (path_list)
{
next = path_list->next;
free ((void *) path_list->name);
free (path_list);
path_list = next;
}
}