block: Don't copy backing file name on error
bdrv_open_backing_file() tries to copy the backing file name using
pstrcpy directly after calling bdrv_open() to open the backing file
without checking whether that was actually successful. If it was not,
ps->backing_hd->file will probably be NULL and qemu will crash.
Fix this by moving pstrcpy after checking whether bdrv_open() succeeded.
Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Benoit Canet <[email protected]>
Reviewed-by: Amos Kong <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>