aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Woodward2005-01-11 22:50:43 +0000
committerJason Woodward2005-01-11 22:50:43 +0000
commit6e3035a1c6fd9112f99a34997ed831abbfc78ac7 (patch)
tree221d1175325196539ac85127370ca968431f5fae /src
parent01d4421206a0929e879ae1dd75bf8a1c5a61d0aa (diff)
downloadslapt-get-6e3035a1c6fd9112f99a34997ed831abbfc78ac7.tar.gz
added a few missing free() calls, and a missing closedir() call in working_dir_init()
Diffstat (limited to 'src')
-rw-r--r--src/configuration.c2
-rw-r--r--src/package.c8
-rw-r--r--src/transaction.c1
3 files changed, 11 insertions, 0 deletions
diff --git a/src/configuration.c b/src/configuration.c
index 1bd0c71..3aa6a2b 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -148,6 +148,7 @@ void working_dir_init(const rc_config *global_config){
exit(1);
}
}
+ closedir(working_dir);
if( access(global_config->working_dir,W_OK) == -1 ){
if( errno ) perror(global_config->working_dir);
@@ -166,6 +167,7 @@ void free_rc_config(rc_config *global_config){
free(global_config->exclude_list->excludes[i]);
}
+ free(global_config->exclude_list->excludes);
free(global_config->exclude_list);
free(global_config);
diff --git a/src/package.c b/src/package.c
index df4362f..2e3e55c 100644
--- a/src/package.c
+++ b/src/package.c
@@ -503,6 +503,7 @@ struct pkg_list *get_installed_pkgs(void){
/* open the package log file to grok data about the package from it */
pkg_f = open_file(pkg_f_name,"r");
+ free(pkg_f_name);
if( pkg_f == NULL ) exit(1);
while( (bytes_read = getline(&getline_buffer,&getline_len,pkg_f)) != EOF ){
execute_regex(&compressed_size_reg,getline_buffer);
@@ -543,6 +544,7 @@ struct pkg_list *get_installed_pkgs(void){
}
}
}
+ if(getline_buffer) free(getline_buffer);
fclose(pkg_f);
add_pkg_to_pkg_list(list,tmp_pkg);
@@ -606,6 +608,8 @@ int install_pkg(const rc_config *global_config,pkg_info_t *pkg){
printf(_("Preparing to install %s-%s\n"),pkg->name,pkg->version);
if( (cmd_return = system(command)) != 0 ){
printf(_("Failed to execute command: [%s]\n"),command);
+ free(command);
+ free(pkg_file_name);
return -1;
}
@@ -631,6 +635,8 @@ int upgrade_pkg(const rc_config *global_config,pkg_info_t *installed_pkg,pkg_inf
printf(_("Preparing to replace %s-%s with %s-%s\n"),pkg->name,installed_pkg->version,pkg->name,pkg->version);
if( (cmd_return = system(command)) != 0 ){
printf(_("Failed to execute command: [%s]\n"),command);
+ free(command);
+ free(pkg_file_name);
return -1;
}
@@ -657,6 +663,7 @@ int remove_pkg(const rc_config *global_config,pkg_info_t *pkg){
command = strncat(command,pkg->version,strlen(pkg->version));
if( (cmd_return = system(command)) != 0 ){
printf(_("Failed to execute command: [%s]\n"),command);
+ free(command);
return -1;
}
@@ -1895,6 +1902,7 @@ size_t get_pkg_file_size(const rc_config *global_config,pkg_info_t *pkg){
if( stat(file_name,&file_stat) == 0 ){
file_size = file_stat.st_size;
}
+ free(file_name);
return file_size;
}
diff --git a/src/transaction.c b/src/transaction.c
index 283cdf1..5844233 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -413,6 +413,7 @@ void free_transaction(transaction_t *tran){
for(i = 0;i < tran->upgrade_pkgs->pkg_count; i++){
free(tran->upgrade_pkgs->pkgs[i]->upgrade);
free(tran->upgrade_pkgs->pkgs[i]->installed);
+ free(tran->upgrade_pkgs->pkgs[i]);
}
free(tran->upgrade_pkgs->pkgs);