]> xenbits.xensource.com Git - libvirt.git/commit
Fix memory leaks in libvirtd's message processing
authorMatthias Bolte <matthias.bolte@googlemail.com>
Wed, 30 Sep 2009 00:17:27 +0000 (02:17 +0200)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Wed, 30 Sep 2009 00:27:00 +0000 (02:27 +0200)
commitc6f1459eb998619ab21a92d9bb87341f26978181
tree0e42c30f84ea8109a79628ccdbfe13a60bf876dc
parent727cda9d1f51d7368c136cb2187eb57385015b24
Fix memory leaks in libvirtd's message processing

Commit 47cab734995fa9521b1df05d37e9978eedd8d3a2 changed the way how
qemud_client_message objects were reused. Before this commit
remoteDispatchClientRequest() reused the received message for normal responses
and to report non-fatal errors. If a fatal error occurred qemudWorker() frees
the message. After this commit non-fatal errors are reported by
remoteSerializeReplyError() using a new qemud_client_message object and the
original message leaks.

To fix this leak the original message has to be freed if
remoteSerializeReplyError() succeeds. If remoteSerializeReplyError()
fails the original message is freed in qemudWorker().

* daemon/dispatch.c: free qemud_client_message objects that will not be reused
  and would leak otherwise, also free the allocated qemud_client_message object
  in remoteSerializeError() if an error occurs
daemon/dispatch.c