return re;
}
+static void
+free_regexp_list(regex_t *reglist, int names)
+{
+ int i;
+ for (i = 0; i < names; i++)
+ regfree(®list[i]);
+ free(reglist);
+}
+
static regex_t *
build_regexp_list(int names, char **namelist)
{
if (regcomp(®list[i], namelist[i], flag) != 0)
{
fprintf(stderr, _("killall: Bad regular expression: %s\n"), namelist[i]);
+ free_regexp_list(reglist, i);
exit (1);
}
}
}
if (command)
free(command);
- free(reglist);
+ if (reglist)
+ free_regexp_list(reglist, name_count);
free(pgids);
if (!quiet)
for (i = 0; i < name_count; i++)