---
src/rpc/virnetclient.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index bf2547c..0184998 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -923,25 +923,12 @@ void virNetClientRemoveStream(virNetClientPtr client,
virNetClientLock(client);
size_t i;
for (i = 0 ; i < client->nstreams ; i++) {
- if (client->streams[i] == st)
+ if (client->streams[i] == st) {
+ VIR_DELETE_ELEMENT(client->streams, i, client->nstreams);
+ virObjectUnref(st);
break;
+ }
}
- if (i == client->nstreams)
- goto cleanup;
-
- if (client->nstreams > 1) {
- memmove(client->streams + i,
- client->streams + i + 1,
- sizeof(*client->streams) *
- (client->nstreams - (i + 1)));
- VIR_SHRINK_N(client->streams, client->nstreams, 1);
- } else {
- VIR_FREE(client->streams);
- client->nstreams = 0;
- }
- virObjectUnref(st);
-
-cleanup:
virNetClientUnlock(client);
}
--
1.7.11.7