Files
xen/tools/libxl
Ian Jackson 9fe1ab7075 libxl: Fix error handling in libxl_userdata_unlink
Previously:
  * rc would not be set before leaving the function, with the
    result that an uninitialised value would be returned
  * failures of libxl__userdata_path would result in a NULL dereference
  * failures of unlink() would not be usefully logged

This appears to be due to an attempt to avoid having to repeat the
call to libxl__unlock_domain_userdata by informally sharing parts of
the success and failure paths.

Change to use the canonical error-handling style:
  * Initialise lock to 0.
  * Do the unlock in the `out' section - always attempt to unlock
    lock if it is non-0.
  * Explicitly set rc and `goto out' on all error paths, even
    those right at the end of the function.
  * Add an error check for filename = libxl__userdata_path(...);

Coverity-ID: 1240237, 1240235.
CC: Wei Liu <wei.liu2@citrix.com>
CC: coverity@xenproject.org
Reviewed-by: Andrew Cooper<andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2014-10-08 11:51:37 +01:00
..
2013-10-10 15:48:55 +01:00
2011-04-04 14:54:46 +01:00
2012-10-05 14:34:30 +01:00
2014-07-10 13:06:55 +01:00
2014-06-18 17:19:25 +01:00
2014-06-18 17:19:25 +01:00
2012-08-24 12:38:16 +01:00
2014-05-02 17:50:23 +01:00
2014-05-02 17:50:23 +01:00
2013-10-10 15:48:55 +01:00
2011-10-12 16:21:32 +01:00