From e03e8083dcf5444e6e6785fd227c4f0e634cb5ae Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 8 Mar 2014 11:25:35 -0500 Subject: add print_allocated_list for lists which need to be freed --- expac.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/expac.c b/expac.c index e4bb9ca..2a524bf 100644 --- a/expac.c +++ b/expac.c @@ -402,6 +402,12 @@ static int print_list(alpm_list_t *list, extractfn fn, bool shortdeps) { return out; } +static int print_allocated_list(alpm_list_t *list, extractfn fn, bool shortdeps) { + int out = print_list(list, fn, shortdeps); + alpm_list_free(list); + return out; +} + static int print_time(time_t timestamp) { char buffer[64]; int out = 0; @@ -613,17 +619,11 @@ static int print_pkg(alpm_pkg_t *pkg, const char *format) { out += print_list(alpm_pkg_get_backup(pkg), alpm_backup_get_name, shortdeps); break; case 'V': /* package validation */ - out += print_list(get_validation_method(pkg), NULL, false); + out += print_allocated_list(get_validation_method(pkg), NULL, false); break; case 'M': /* modified */ - { - alpm_list_t *modified_files = get_modified_files(pkg); - if(modified_files != NULL) { - out += print_list(modified_files, NULL, shortdeps); - alpm_list_free(modified_files); - } + out += print_allocated_list(get_modified_files(pkg), NULL, shortdeps); break; - } case '%': fputc('%', stdout); out++; -- cgit v1.2.3-70-g09d2