tools/xl: check return value of printf_info_one_json() in list_domains_details()

And return from the function early if printf_info_one_json() returns error.

Reported by internal XenServer Coverity instance.

Fixes: f6c6f2679d ("libxl: Convert libxl__object_to_json() to json-c")
Signed-off-by: Roger Pau Monné <roger.pua@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
This commit is contained in:
Roger Pau Monne committed 2025-10-16 17:20:32 +02:00
1 parent a4d92cf189
commit d0193c6d67
1 file changed
+2
+2
View File
@@ -584,6 +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);
#elif defined(HAVE_LIBYAJL)
s = printf_info_one_json(hand, info[i].domid, &d_config);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.