[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] tools/xl: fix for dead code in list_domains_details()



commit 80fb43a1b583334363608b0d74a863c5a67a0d02
Author:     Roger Pau Monne <roger.pau@xxxxxxxxxx>
AuthorDate: Mon Oct 20 13:19:59 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Oct 21 16:56:35 2025 +0100

    tools/xl: fix for dead code in list_domains_details()
    
    Commit d0193c6d6716 introduced checking for the return value of
    printf_info_one_json(), but failed to remove a further check down, which
    now Coverity complains is dead code.
    
    The correct fix is to make the call to json_object_array_add() conditional
    on printf_info_one_json() having been successful, so that the further call
    to libxl_domain_config_dispose() is not avoided.
    
    CID: 1667251
    Fixes: d0193c6d6716 ("tools/xl: check return value of 
printf_info_one_json() in list_domains_details()")
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
    Reviewed-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
 tools/xl/xl_info.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/xl/xl_info.c b/tools/xl/xl_info.c
index dbb682cc52..98fc879e63 100644
--- a/tools/xl/xl_info.c
+++ b/tools/xl/xl_info.c
@@ -584,9 +584,8 @@ static void list_domains_details(const libxl_dominfo *info, 
int nb_domain)
 #ifdef HAVE_LIBJSONC
             json_object *jso_value;
             rc = printf_info_one_json(&jso_value, info[i].domid, &d_config);
-            if (rc)
-                goto out;
-            json_object_array_add(jso, jso_value);
+            if (!rc)
+                json_object_array_add(jso, jso_value);
 #elif defined(HAVE_LIBYAJL)
             s = printf_info_one_json(hand, info[i].domid, &d_config);
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.