}
static int grub2_parse(struct discover_context *dc)
- {
+{
const char * const *filename;
struct grub2_parser *parser;
int len, rc;
if (dc->event)
return -1;
- parser = grub2_parser_create(dc);
-
for (filename = grub2_conf_files; *filename; filename++) {
rc = parser_request_file(dc, dc->device, *filename, &buf, &len);
if (rc)
continue;
- grub2_parser_parse(parser, buf, len);
+ parser = grub2_parser_create(dc);
+ grub2_parser_parse(parser, *filename, buf, len);
talloc_free(buf);
+ talloc_free(parser);
+ break;
}
- talloc_free(parser);
return 0;
}