summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2014-02-03 12:09:18 -0500
committerAllan McRae <allan@archlinux.org>2014-02-04 13:48:37 +1000
commitb9601b1e597c64df9d04678509c31f9bab538fd2 (patch)
treef4976bded497ef1e5a1d7b41a3b57762202dd95d /src
parent953808a9ee86fc5bcd63f4458662a5c73ccf37d1 (diff)
alpm: export *_free functions
Front-ends should be able to free memory that alpm hands them. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/remove.c3
-rw-r--r--src/pacman/sync.c13
2 files changed, 10 insertions, 6 deletions
diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index 56b93334..00bd3b3b 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -121,12 +121,13 @@ int pacman_remove(alpm_list_t *targets)
char *depstring = alpm_dep_compute_string(miss->depend);
colon_printf(_("%s: requires %s\n"), miss->target, depstring);
free(depstring);
+ alpm_depmissing_free(miss);
}
break;
default:
break;
}
- FREELIST(data);
+ alpm_list_free(data);
retval = 1;
goto cleanup;
}
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 3cb73bc5..e0a1e426 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -764,8 +764,9 @@ int sync_prepare_execute(void)
switch(err) {
case ALPM_ERR_PKG_INVALID_ARCH:
for(i = data; i; i = alpm_list_next(i)) {
- const char *pkg = i->data;
+ char *pkg = i->data;
colon_printf(_("package %s does not have a valid architecture\n"), pkg);
+ free(pkg);
}
break;
case ALPM_ERR_UNSATISFIED_DEPS:
@@ -774,6 +775,7 @@ int sync_prepare_execute(void)
char *depstring = alpm_dep_compute_string(miss->depend);
colon_printf(_("%s: requires %s\n"), miss->target, depstring);
free(depstring);
+ alpm_depmissing_free(miss);
}
break;
case ALPM_ERR_CONFLICTING_DEPS:
@@ -789,6 +791,7 @@ int sync_prepare_execute(void)
conflict->package1, conflict->package2, reason);
free(reason);
}
+ alpm_conflict_free(conflict);
}
break;
default:
@@ -848,6 +851,7 @@ int sync_prepare_execute(void)
conflict->target, conflict->file);
break;
}
+ alpm_fileconflict_free(conflict);
}
break;
case ALPM_ERR_PKG_INVALID:
@@ -855,8 +859,9 @@ int sync_prepare_execute(void)
case ALPM_ERR_PKG_INVALID_SIG:
case ALPM_ERR_DLT_INVALID:
for(i = data; i; i = alpm_list_next(i)) {
- const char *filename = i->data;
+ char *filename = i->data;
printf(_("%s is invalid or corrupted\n"), filename);
+ free(filename);
}
break;
default:
@@ -870,9 +875,7 @@ int sync_prepare_execute(void)
/* Step 4: release transaction resources */
cleanup:
- if(data) {
- FREELIST(data);
- }
+ alpm_list_free(data);
if(trans_release() == -1) {
retval = 1;
}