On 2/25/21 1:20 PM, Ján Tomko wrote:
On a Tuesday in 2021, Kristina Hanicova wrote:
In: vshTableRowNew(), vshTablePrint(), vshTablePrintToStdout().
Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx>
---
tools/vsh-table.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/tools/vsh-table.c b/tools/vsh-table.c
index d09cc9e14e..2e10abfc90 100644
--- a/tools/vsh-table.c
+++ b/tools/vsh-table.c
@@ -361,8 +359,8 @@ vshTablePrint(vshTablePtr table, bool header)
{
size_t i;
size_t j;
- size_t *maxwidths;
- size_t **widths;
+ g_autofree size_t *maxwidths = NULL;
+ g_autofree size_t **widths = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
char *ret = NULL;
@@ -395,10 +393,8 @@ vshTablePrint(vshTablePtr table, bool header)
ret = virBufferContentAndReset(&buf);
cleanup:
- VIR_FREE(maxwidths);
for (i = 0; i < table->nrows; i++)
VIR_FREE(widths[i]);
- VIR_FREE(widths);
While this does not change the behavior, mixing g_autofree for the outer
array while using VIR_FREE for the per-row arrays feels incomplete.
Any idea what would make it feel complete again?
Michal