[pacman-dev] [PATCH] create_verbose_row: free malloc'd cells
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> --- src/pacman/util.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pacman/util.c b/src/pacman/util.c index 05135d7..9338d2a 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -808,23 +808,23 @@ static alpm_list_t *create_verbose_row(pm_target_t *target) } else { pm_asprintf(&str, "%s", alpm_pkg_get_name(target->remove)); } - add_table_cell(&ret, str, CELL_NORMAL); + add_table_cell(&ret, str, CELL_NORMAL | CELL_FREE); /* old and new versions */ pm_asprintf(&str, "%s", target->remove != NULL ? alpm_pkg_get_version(target->remove) : ""); - add_table_cell(&ret, str, CELL_NORMAL); + add_table_cell(&ret, str, CELL_NORMAL | CELL_FREE); pm_asprintf(&str, "%s", target->install != NULL ? alpm_pkg_get_version(target->install) : ""); - add_table_cell(&ret, str, CELL_NORMAL); + add_table_cell(&ret, str, CELL_NORMAL | CELL_FREE); /* and size */ size -= target->remove ? alpm_pkg_get_isize(target->remove) : 0; size += target->install ? alpm_pkg_get_isize(target->install) : 0; human_size = humanize_size(size, 'M', 2, &label); pm_asprintf(&str, "%.2f %s", human_size, label); - add_table_cell(&ret, str, CELL_RIGHT_ALIGN); + add_table_cell(&ret, str, CELL_RIGHT_ALIGN | CELL_FREE); size = target->install ? alpm_pkg_download_size(target->install) : 0; if(size != 0) { -- 1.8.5.2
On 04/01/14 05:09, Andrew Gregory wrote:
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> --- src/pacman/util.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/pacman/util.c b/src/pacman/util.c index 05135d7..9338d2a 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -808,23 +808,23 @@ static alpm_list_t *create_verbose_row(pm_target_t *target) } else { pm_asprintf(&str, "%s", alpm_pkg_get_name(target->remove)); } - add_table_cell(&ret, str, CELL_NORMAL); + add_table_cell(&ret, str, CELL_NORMAL | CELL_FREE);
/* old and new versions */ pm_asprintf(&str, "%s", target->remove != NULL ? alpm_pkg_get_version(target->remove) : ""); - add_table_cell(&ret, str, CELL_NORMAL); + add_table_cell(&ret, str, CELL_NORMAL | CELL_FREE);
pm_asprintf(&str, "%s", target->install != NULL ? alpm_pkg_get_version(target->install) : ""); - add_table_cell(&ret, str, CELL_NORMAL); + add_table_cell(&ret, str, CELL_NORMAL | CELL_FREE);
/* and size */ size -= target->remove ? alpm_pkg_get_isize(target->remove) : 0; size += target->install ? alpm_pkg_get_isize(target->install) : 0; human_size = humanize_size(size, 'M', 2, &label); pm_asprintf(&str, "%.2f %s", human_size, label); - add_table_cell(&ret, str, CELL_RIGHT_ALIGN); + add_table_cell(&ret, str, CELL_RIGHT_ALIGN | CELL_FREE);
size = target->install ? alpm_pkg_download_size(target->install) : 0; if(size != 0) {
What about the final table row here? It looks like it needs freed too. A
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> --- src/pacman/util.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pacman/util.c b/src/pacman/util.c index 58b0cec..f6ccaf8 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -808,23 +808,23 @@ static alpm_list_t *create_verbose_row(pm_target_t *target) } else { pm_asprintf(&str, "%s", alpm_pkg_get_name(target->remove)); } - add_table_cell(&ret, str, CELL_NORMAL); + add_table_cell(&ret, str, CELL_NORMAL | CELL_FREE); /* old and new versions */ pm_asprintf(&str, "%s", target->remove != NULL ? alpm_pkg_get_version(target->remove) : ""); - add_table_cell(&ret, str, CELL_NORMAL); + add_table_cell(&ret, str, CELL_NORMAL | CELL_FREE); pm_asprintf(&str, "%s", target->install != NULL ? alpm_pkg_get_version(target->install) : ""); - add_table_cell(&ret, str, CELL_NORMAL); + add_table_cell(&ret, str, CELL_NORMAL | CELL_FREE); /* and size */ size -= target->remove ? alpm_pkg_get_isize(target->remove) : 0; size += target->install ? alpm_pkg_get_isize(target->install) : 0; human_size = humanize_size(size, 'M', 2, &label); pm_asprintf(&str, "%.2f %s", human_size, label); - add_table_cell(&ret, str, CELL_RIGHT_ALIGN); + add_table_cell(&ret, str, CELL_RIGHT_ALIGN | CELL_FREE); size = target->install ? alpm_pkg_download_size(target->install) : 0; if(size != 0) { @@ -833,7 +833,7 @@ static alpm_list_t *create_verbose_row(pm_target_t *target) } else { str = NULL; } - add_table_cell(&ret, str, CELL_RIGHT_ALIGN); + add_table_cell(&ret, str, CELL_RIGHT_ALIGN | CELL_FREE); return ret; } -- 1.8.5.2
participants (2)
-
Allan McRae
-
Andrew Gregory