_cleanup_fclose_ FILE *f = NULL;
_cleanup_strv_free_ char **match_list = NULL;
uint32_t line_number = 0;
- char *match = NULL;
int r = 0, err;
f = fopen(filename, "re");
/* start of record, first match */
state = HW_MATCH;
- match = strdup(line);
- if (!match)
- return -ENOMEM;
-
- err = strv_consume(&match_list, match);
+ err = strv_extend(&match_list, line);
if (err < 0)
return err;
if (line[0] != ' ') {
/* another match */
- match = strdup(line);
- if (!match)
- return -ENOMEM;
-
- err = strv_consume(&match_list, match);
+ err = strv_extend(&match_list, line);
if (err < 0)
return err;