diff options
author | Dave Reisner <d@falconindy.com> | 2010-11-30 19:23:20 -0500 |
---|---|---|
committer | Dave Reisner <d@falconindy.com> | 2010-11-30 19:40:47 -0500 |
commit | 044c141f8999e3962eefff62553045b57fa2bc85 (patch) | |
tree | b3fc09900679adf03072c87eaaf1a74130ebae65 | |
parent | f827493abf3d6615818baec9ac1496196629eec4 (diff) | |
download | expac-044c141f8999e3962eefff62553045b57fa2bc85.tar.xz |
fix leak by always allocating for the dblist
-rw-r--r-- | expac.c | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -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); |