Signed-off-by: Andrew Gregory <[email protected]>
---
 src/pacman/util.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/pacman/util.c b/src/pacman/util.c
index 58b0cec..1982c89 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -589,9 +589,10 @@ static int table_display(const alpm_list_t *header,
        const alpm_list_t *i, *first;
        size_t *widths = NULL, totalcols, totalwidth;
        int *has_data = NULL;
+       int ret = 0;
 
        if(rows == NULL) {
-               return 0;
+               return ret;
        }
 
        /* we want the first row. if no headers are provided, use the first
@@ -605,10 +606,12 @@ static int table_display(const alpm_list_t *header,
        if(totalwidth > cols) {
                pm_printf(ALPM_LOG_WARNING,
                                _("insufficient columns available for table 
display\n"));
-               return -1;
+               ret = -1;
+               goto cleanup;
        }
        if(!totalwidth || !widths || !has_data) {
-               return -1;
+               ret = -1;
+               goto cleanup;
        }
 
        if(header) {
@@ -620,9 +623,10 @@ static int table_display(const alpm_list_t *header,
                table_print_line(i->data, padding, totalcols, widths, has_data);
        }
 
+cleanup:
        free(widths);
        free(has_data);
-       return 0;
+       return ret;
 }
 
 void list_display(const char *title, const alpm_list_t *list,
-- 
1.8.5.2


Reply via email to