case OPT_DELETE_REGEXP:
free(global_prefix_regexp);
global_prefix_regexp = safe_malloc(sizeof(*global_prefix_regexp));
- regcomp(global_prefix_regexp, optarg, 0);
+
+ if(regcomp(global_prefix_regexp, optarg, 0)) {
+ fprintf(stderr, "selector: Regexp syntax error `%s'.\n", optarg);
+ exit(EXIT_FAILURE);
+ }
break;
case 'r':
free(labels);
free(lines);
free(global_title);
- free(global_prefix_regexp);
+
+ if(global_prefix_regexp) {
+ regfree(global_prefix_regexp);
+ free(global_prefix_regexp);
+ }
exit(EXIT_SUCCESS);
}