aboutsummaryrefslogtreecommitdiffstats
path: root/g10/g10.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--g10/g10.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/g10/g10.c b/g10/g10.c
index 73cb147b0..cab9dc371 100644
--- a/g10/g10.c
+++ b/g10/g10.c
@@ -116,7 +116,7 @@ wrong_args( const char *text)
fputs(_("Usage: g10 [options] "),stderr);
fputs(text,stderr);
putc('\n',stderr);
- exit(2);
+ g10_exit(2);
}
static void
@@ -150,14 +150,14 @@ set_cmd( enum cmd_values *ret_cmd, enum cmd_values new_cmd )
cmd = aKModeC;
else {
log_error(_("conflicting commands\n"));
- exit(2);
+ g10_exit(2);
}
*ret_cmd = cmd;
}
-int
+void
main( int argc, char **argv )
{
static ARGPARSE_OPTS opts[] = {
@@ -237,6 +237,8 @@ main( int argc, char **argv )
enum cmd_values cmd = 0;
+ secmem_init( 16384 );
+
i18n_init();
opt.compress = -1; /* defaults to standard compress level */
opt.def_cipher_algo = CIPHER_ALGO_BLOWFISH;
@@ -397,7 +399,7 @@ main( int argc, char **argv )
errors++;
}
if( errors )
- exit(2);
+ g10_exit(2);
set_debug();
@@ -673,7 +675,17 @@ main( int argc, char **argv )
/* cleanup */
FREE_STRLIST(remusr);
FREE_STRLIST(locusr);
- return log_get_errorcount(0)? 2:0;
+ g10_exit(0);
+}
+
+
+void
+g10_exit( int rc )
+{
+ if( opt.verbose )
+ secmem_dump_stats();
+ secmem_term();
+ exit( rc? rc : log_get_errorcount(0)? 2:0 );
}