aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorJason Woodward2005-01-18 21:25:29 +0000
committerJason Woodward2005-01-18 21:25:29 +0000
commit2283991abd00c75b5208412e22b813c7780f2db8 (patch)
tree9bd3dc949ac4b99e573f7315f4d9b999b97154d3 /src/main.c
parent79c17f7766dc2774def7c26665e4afb7d9aae717 (diff)
downloadslapt-get-2283991abd00c75b5208412e22b813c7780f2db8.tar.gz
free config struct before exiting on error (removing complaint by valgrind)
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 434f0b6..a1260e6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -135,6 +135,7 @@ int main( int argc, char *argv[] ){
break;
case HELP_OPT: /* help */
usage();
+ free_rc_config(global_config);
exit(1);
case IGNORE_DEP_OPT: /* ignore-dep */
global_config->ignore_dep = TRUE;
@@ -153,6 +154,7 @@ int main( int argc, char *argv[] ){
rc_config *tmp_gc = global_config;
global_config = read_rc_config(optarg);
if( global_config == NULL ){
+ free_rc_config(tmp_gc);
exit(1);
}
/* preserve existing command line options */
@@ -178,6 +180,7 @@ int main( int argc, char *argv[] ){
break;
default:
usage();
+ free_rc_config(global_config);
exit(1);
}
}
@@ -199,6 +202,7 @@ int main( int argc, char *argv[] ){
if( do_action == USAGE ){
usage();
+ free_rc_config(global_config);
exit(1);
}
@@ -208,7 +212,10 @@ int main( int argc, char *argv[] ){
switch(do_action){
case UPDATE:
- if( update_pkg_cache(global_config) == 1 ) exit(1);
+ if( update_pkg_cache(global_config) == 1 ){
+ free_rc_config(global_config);
+ exit(1);
+ }
break;
case INSTALL:
paa = init_pkg_action_args((argc - optind));