{
const char *ctype;
char *crequest;
+ int exit_code = 0;
env_lang=getenv("LC_ALL");
if (!env_lang) env_lang=getenv("LC_MESSAGES");
#ifndef NO_REGEX
if (Match)
- exit(find_matches() != 0);
+ {
+ exit_code = (find_matches() != 0);
+ regfree(&Re_pat);
+ goto cleanup;
+ }
#endif
init_prob();
if (Find_files)
sleep((unsigned int) max(Fort_len / CPERS, MINW));
}
}
+cleanup:
recode_delete_request(request);
recode_delete_outer(outer);
/* Free the File_list */
free_desc(File_list);
- exit(0);
+ free(Fortbuf);
+ exit(exit_code);
/* NOTREACHED */
}
use Test::RunValgrind;
# plan skip_all => 'lib-recode has memory leaks';
-plan tests => 2;
+plan tests => 3;
my $obj = Test::RunValgrind->new({});
blurb => 'fortune -f valgrind test',
}
);
+
+# TEST
+$obj->run(
+ {
+ log_fn => './fortune--3-dash-m.valgrind-log',
+ prog => './fortune',
+ argv => [qw/-m foobarbazINGAMINGATONGALKIYRE/],
+ blurb => 'fortune -m valgrind test',
+ }
+);