mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
tools/libxl: avoid freeing stack rubble in libxl__json_object_to_json()
It's possible for libxl__json_object_to_json_object() to not set the passed
jso_out parameter, hence initialize it in libxl__json_object_to_json() to
avoid freeing an uninitialized pointer in case of failure.
Reported by XenServer internal Coverity instance.
Fixes: 75fa670e58 ("libxl: Convert libxl__json_object_to_json() to json_object")
Signed-off-by: Roger Pau Monné <roger.pau@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:
1 parent
98cdab1679
commit
3539308d82
1 file changed
+1
-1
@@ -1531,7 +1531,7 @@ char *libxl__json_object_to_json(libxl__gc *gc,
|
||||
{
|
||||
#ifdef HAVE_LIBJSONC
|
||||
const char *buf;
|
||||
json_object *root;
|
||||
json_object *root = NULL;
|
||||
char *ret = NULL;
|
||||
int rc;
|
||||
|
||||
|
||||