diff --git a/tests/vshtabletest.c b/tests/vshtabletest.c index 79285b14a9eda68e73dd7a1aaa00439441627b75..b07db3cf2339cd0c6699ec7743a0b2169205a52b 100644 --- a/tests/vshtabletest.c +++ b/tests/vshtabletest.c @@ -291,7 +291,8 @@ testNTables(const void *opaque ATTRIBUTE_UNUSED) " Id Name Status\n" "--------------------------\n" " 1 fedora28 running\n" - " 2 rhel7.5 running\n"; + " 2 rhel7.5 running\n" + " 3 gazpacho \n"; const char *exp2 = " Id Name Status\n" "---------------------\n"; @@ -311,6 +312,7 @@ testNTables(const void *opaque ATTRIBUTE_UNUSED) goto cleanup; vshTableRowAppend(table1, "1", "fedora28", "running", NULL); vshTableRowAppend(table1, "2", "rhel7.5", "running", NULL); + vshTableRowAppend(table1, "3", "gazpacho", "", NULL); act1 = vshTablePrintToString(table1, true); table2 = vshTableNew("Id", "Name", "Status", NULL); diff --git a/tools/vsh-table.c b/tools/vsh-table.c index fda8f15879661597ced45917b388e59c2463f3e6..8bd6d99778227ec7bc5e052a3df3fcf9ef3b2e8a 100644 --- a/tools/vsh-table.c +++ b/tools/vsh-table.c @@ -219,9 +219,6 @@ vshTableSafeEncode(const char *s, size_t *width) memset(&st, 0, sizeof(st)); - if (!sz) - return NULL; - if (VIR_ALLOC_N(buf, (sz * HEX_ENCODE_LENGTH) + 1) < 0) return NULL;