libxl: Fix uninitialized pointer when passing an empty cdrom
authorGeorge Dunlap <george.dunlap@citrix.com>
Wed, 6 Apr 2016 11:34:06 +0000 (12:34 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 6 Apr 2016 13:46:54 +0000 (14:46 +0100)
commitef498d99bb6d722d83ae026914dd4709bbe14caf
tree003a04e70cfca4e09bad2cdf361b11747083f90c
parent50b5df7dccd052b685084abe31a4b6be43c976ae
libxl: Fix uninitialized pointer when passing an empty cdrom

Commit 3fec17d4bb56567d139d7806392f4d8702d3f6a7 introduced a bug where
an empty cdrom would cause target_path to be uninitialized.  Initialize
target_path to NULL instead.

The other option here would have been to set target_path to NULL only
on the LIBXL_DISK_FORMAT_EMPTY path.  That would potentially enable
the compiler to catch future uninitialized paths, rather than having
those paths (potentially) dereference a NULL pointer.  But given that
a bunch of our compilers failed to catch *this* uninitialized path,
setting it to NULL at declaration seems the safer option for now.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
tools/libxl/libxl_dm.c