1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-26 03:21:44 +03:00

Fix leak of 'msg' object in client stream code

In one exit path we forgot to free the virNetMessage object causing
a large memory leak for streams which send a lot of data. Some other
paths were calling VIR_FREE directly instead of virNetMessageFree
although this was (currently) harmless.

* src/rpc/virnetclientstream.c: Fix leak of msg object
* src/rpc/virnetclientprogram.c: Call virNetMessageFree instead
  of VIR_FREE
This commit is contained in:
Daniel P. Berrange 2011-07-08 12:35:36 +01:00
parent 3e5d48ef33
commit 927dfcf693
2 changed files with 4 additions and 3 deletions

View File

@ -329,11 +329,11 @@ int virNetClientProgramCall(virNetClientProgramPtr prog,
goto error;
}
VIR_FREE(msg);
virNetMessageFree(msg);
return 0;
error:
VIR_FREE(msg);
virNetMessageFree(msg);
return -1;
}

View File

@ -361,11 +361,12 @@ int virNetClientStreamSendPacket(virNetClientStreamPtr st,
if (virNetClientSend(client, msg, wantReply) < 0)
goto error;
virNetMessageFree(msg);
return nbytes;
error:
VIR_FREE(msg);
virNetMessageFree(msg);
return -1;
}