On 2/19/19 3:21 PM, Richard W.M. Jones wrote:
On Tue, Feb 19, 2019 at 09:21:10AM -0600, Eric Blake wrote:
Missing an unlink(). Also, does the caller properly use close(disk->fd) on early exits like this, or does it not matter because we're just going to exit()?
Just about the early exits: I started off trying to get those paths right but it made the code ridiculously complicated so I gave up. As you say config_complete just calls exit, so it's not really a problem, in fact more likely to cause bugs than fix them.
Fair enough. The unlink() is an obvious cleanup worth doing (no need to litter $TMPDIR, as the filesystem is not an automatic cleanup on process termination), but memory/fd leaks are acceptable, although it's probably also worth a comment in the code stating that we know we are leaking on failure on the assumption that the caller will exit(). -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org