[PATCH] qemu: fix memory leak on some paths