summaryrefslogtreecommitdiffstats
path: root/expac.c
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2010-11-30 19:23:20 -0500
committerDave Reisner <d@falconindy.com>2010-11-30 19:40:47 -0500
commit044c141f8999e3962eefff62553045b57fa2bc85 (patch)
treeb3fc09900679adf03072c87eaaf1a74130ebae65 /expac.c
parentf827493abf3d6615818baec9ac1496196629eec4 (diff)
downloadexpac-044c141f8999e3962eefff62553045b57fa2bc85.tar.xz
fix leak by always allocating for the dblist
Diffstat (limited to 'expac.c')
-rw-r--r--expac.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/expac.c b/expac.c
index feecdbc..50d304f 100644
--- a/expac.c
+++ b/expac.c
@@ -164,7 +164,7 @@ static int parse_options(int argc, char *argv[]) {
fprintf(stderr, "error: can only select one repo option (use -h for help)\n");
return(1);
}
- dblist = alpm_option_get_syncdbs();
+ dblist = alpm_list_copy(alpm_option_get_syncdbs());
break;
case 'Q':
if (dblist) {
@@ -474,7 +474,7 @@ alpm_list_t *resolve_pkg(alpm_list_t *targets) {
}
int main(int argc, char *argv[]) {
- int ret = 0, freelist = 0;
+ int ret = 0;
alpm_list_t *results, *i;
ret = alpm_init();
@@ -490,7 +490,6 @@ int main(int argc, char *argv[]) {
/* default vals */
if (!dblist) {
dblist = alpm_list_add(dblist, db_local);
- freelist = 1;
}
delim = delim ? delim : "\n";
listdelim = listdelim ? listdelim : " ";
@@ -514,11 +513,8 @@ int main(int argc, char *argv[]) {
alpm_list_free(results);
- if (freelist) {
- alpm_list_free(dblist);
- }
-
finish:
+ alpm_list_free(dblist);
alpm_list_free(targets);
alpm_release();
return(ret);