aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2011-07-04 10:22:50 +0800
committerDaniel Veillard <veillard@redhat.com>2011-07-04 10:22:50 +0800
commit6e07f72ee53738d8a91784bd3df633e9b51e7a6c (patch)
treedbd6fb86e4dff48e4304b848f626ba1d36d23e69 /src/rpc/virnetserverservice.c
parentrpc: fix logic bug (diff)
downloadlibvirt-6e07f72ee53738d8a91784bd3df633e9b51e7a6c.tar.gz
libvirt-6e07f72ee53738d8a91784bd3df633e9b51e7a6c.tar.bz2
libvirt-6e07f72ee53738d8a91784bd3df633e9b51e7a6c.zip
rpc: avoid memory leak on error
Detected by Coverity. The leak is on an error path, but I'm not sure whether that path is likely to be triggered in practice. * src/rpc/virnetserverservice.c (virNetServerServiceAccept): Plug leak.
Diffstat (limited to 'src/rpc/virnetserverservice.c')
-rw-r--r--src/rpc/virnetserverservice.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/rpc/virnetserverservice.c b/src/rpc/virnetserverservice.c
index e84f72c91..8c250e246 100644
--- a/src/rpc/virnetserverservice.c
+++ b/src/rpc/virnetserverservice.c
@@ -82,7 +82,12 @@ cleanup:
return;
error:
- virNetSocketFree(clientsock);
+ if (client) {
+ virNetServerClientClose(client);
+ virNetServerClientFree(client);
+ } else {
+ virNetSocketFree(clientsock);
+ }
}