From: Michael Tokarev Date: Thu, 30 Oct 2014 08:00:01 +0000 (+0300) Subject: virtio-9p-proxy: fix error return in proxy_init() X-Git-Tag: v2.2.0-rc0~14^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6af76c6f7dbcc6255f5a5cac20ad61d1492d4052;p=thirdparty%2Fqemu.git virtio-9p-proxy: fix error return in proxy_init() proxy_init() does not check the return value of connect_namedsocket(), fix this by rearranging code a little bit. Signed-off-by: Michael Tokarev --- diff --git a/hw/9pfs/virtio-9p-proxy.c b/hw/9pfs/virtio-9p-proxy.c index e6bbb06319a..2ec211bbeaf 100644 --- a/hw/9pfs/virtio-9p-proxy.c +++ b/hw/9pfs/virtio-9p-proxy.c @@ -1155,10 +1155,12 @@ static int proxy_init(FsContext *ctx) sock_id = atoi(ctx->fs_root); if (sock_id < 0) { fprintf(stderr, "socket descriptor not initialized\n"); - g_free(proxy); - return -1; } } + if (sock_id < 0) { + g_free(proxy); + return -1; + } g_free(ctx->fs_root); ctx->fs_root = NULL;