116 lines
5.0 KiB
Diff
116 lines
5.0 KiB
Diff
commit 7518ad753fbad5ab0991b7bb189a69db0975c6e8
|
|
Author: Alex Jia <ajia@redhat.com>
|
|
Date: Mon Jul 11 13:14:45 2011 +0800
|
|
|
|
remote: Fix memory leak
|
|
|
|
Detected in valgrind run:
|
|
|
|
==9184== 1 bytes in 1 blocks are definitely lost in loss record 1 of 19
|
|
==9184== at 0x4A04A28: calloc (vg_replace_malloc.c:467)
|
|
==9184== by 0x3073715F78: xdr_array (xdr_array.c:97)
|
|
==9184== by 0x4CF97C9: xdr_remote_domain_get_security_label_ret (remote_protocol.c:1696)
|
|
==9184== by 0x4D08741: virNetMessageDecodePayload (virnetmessage.c:286)
|
|
==9184== by 0x4D00F78: virNetClientProgramCall (virnetclientprogram.c:318)
|
|
==9184== by 0x4CE3887: call (remote_driver.c:3933)
|
|
==9184== by 0x4CF71C6: remoteDomainGetSecurityLabel (remote_driver.c:1580)
|
|
==9184== by 0x4CCA480: virDomainGetSecurityLabel (libvirt.c:7340)
|
|
==9184== by 0x41993A: cmdDominfo (virsh.c:2414)
|
|
==9184== by 0x411E92: vshCommandRun (virsh.c:12730)
|
|
==9184== by 0x4211ED: main (virsh.c:14076)
|
|
==9184==
|
|
==9184== 2 bytes in 1 blocks are definitely lost in loss record 2 of 19
|
|
==9184== at 0x4A04A28: calloc (vg_replace_malloc.c:467)
|
|
==9184== by 0x3073715F78: xdr_array (xdr_array.c:97)
|
|
==9184== by 0x4CF974F: xdr_remote_node_get_security_model_ret (remote_protocol.c:1713)
|
|
==9184== by 0x4D08741: virNetMessageDecodePayload (virnetmessage.c:286)
|
|
==9184== by 0x4D00F78: virNetClientProgramCall (virnetclientprogram.c:318)
|
|
==9184== by 0x4CE3887: call (remote_driver.c:3933)
|
|
==9184== by 0x4CF6F96: remoteNodeGetSecurityModel (remote_driver.c:1648)
|
|
==9184== by 0x4CBF799: virNodeGetSecurityModel (libvirt.c:7382)
|
|
==9184== by 0x4197D7: cmdDominfo (virsh.c:2394)
|
|
==9184== by 0x411E92: vshCommandRun (virsh.c:12730)
|
|
==9184== by 0x4211ED: main (virsh.c:14076)
|
|
==9184==
|
|
==9184== 8 bytes in 1 blocks are definitely lost in loss record 3 of 19
|
|
==9184== at 0x4A04A28: calloc (vg_replace_malloc.c:467)
|
|
==9184== by 0x3073715F78: xdr_array (xdr_array.c:97)
|
|
==9184== by 0x4CF9729: xdr_remote_node_get_security_model_ret (remote_protocol.c:1710)
|
|
==9184== by 0x4D08741: virNetMessageDecodePayload (virnetmessage.c:286)
|
|
==9184== by 0x4D00F78: virNetClientProgramCall (virnetclientprogram.c:318)
|
|
==9184== by 0x4CE3887: call (remote_driver.c:3933)
|
|
==9184== by 0x4CF6F96: remoteNodeGetSecurityModel (remote_driver.c:1648)
|
|
==9184== by 0x4CBF799: virNodeGetSecurityModel (libvirt.c:7382)
|
|
==9184== by 0x4197D7: cmdDominfo (virsh.c:2394)
|
|
==9184== by 0x411E92: vshCommandRun (virsh.c:12730)
|
|
==9184== by 0x4211ED: main (virsh.c:14076)
|
|
==9184==
|
|
==9184== LEAK SUMMARY:
|
|
==9184== definitely lost: 11 bytes in 3 blocks
|
|
|
|
* src/remote/remote_driver.c: Avoid leak on remoteDomainGetSecurityLabel
|
|
and remoteNodeGetSecurityModel.
|
|
|
|
Index: libvirt-0.9.3/AUTHORS
|
|
===================================================================
|
|
--- libvirt-0.9.3.orig/AUTHORS
|
|
+++ libvirt-0.9.3/AUTHORS
|
|
@@ -180,6 +180,7 @@ Patches have also been contributed by:
|
|
David S. Wang <dwang2@cisco.com>
|
|
Ruben Kerkhof <ruben@rubenkerkhof.com>
|
|
Scott Moser <smoser@ubuntu.com>
|
|
+ Alex Jia <ajia@redhat.com>
|
|
|
|
[....send patches to get your name here....]
|
|
|
|
Index: libvirt-0.9.3/src/remote/remote_driver.c
|
|
===================================================================
|
|
--- libvirt-0.9.3.orig/src/remote/remote_driver.c
|
|
+++ libvirt-0.9.3/src/remote/remote_driver.c
|
|
@@ -1587,7 +1587,7 @@ remoteDomainGetSecurityLabel (virDomainP
|
|
if (strlen (ret.label.label_val) >= sizeof seclabel->label) {
|
|
remoteError(VIR_ERR_RPC, _("security label exceeds maximum: %zd"),
|
|
sizeof seclabel->label - 1);
|
|
- goto done;
|
|
+ goto cleanup;
|
|
}
|
|
strcpy (seclabel->label, ret.label.label_val);
|
|
seclabel->enforcing = ret.enforcing;
|
|
@@ -1595,6 +1595,9 @@ remoteDomainGetSecurityLabel (virDomainP
|
|
|
|
rv = 0;
|
|
|
|
+cleanup:
|
|
+ xdr_free((xdrproc_t) xdr_remote_domain_get_security_label_ret, (char *)&ret);
|
|
+
|
|
done:
|
|
remoteDriverUnlock(priv);
|
|
return rv;
|
|
@@ -1655,7 +1658,7 @@ remoteNodeGetSecurityModel (virConnectPt
|
|
if (strlen (ret.model.model_val) >= sizeof secmodel->model) {
|
|
remoteError(VIR_ERR_RPC, _("security model exceeds maximum: %zd"),
|
|
sizeof secmodel->model - 1);
|
|
- goto done;
|
|
+ goto cleanup;
|
|
}
|
|
strcpy (secmodel->model, ret.model.model_val);
|
|
}
|
|
@@ -1664,13 +1667,16 @@ remoteNodeGetSecurityModel (virConnectPt
|
|
if (strlen (ret.doi.doi_val) >= sizeof secmodel->doi) {
|
|
remoteError(VIR_ERR_RPC, _("security doi exceeds maximum: %zd"),
|
|
sizeof secmodel->doi - 1);
|
|
- goto done;
|
|
+ goto cleanup;
|
|
}
|
|
strcpy (secmodel->doi, ret.doi.doi_val);
|
|
}
|
|
|
|
rv = 0;
|
|
|
|
+cleanup:
|
|
+ xdr_free((xdrproc_t) xdr_remote_node_get_security_model_ret, (char *)&ret);
|
|
+
|
|
done:
|
|
remoteDriverUnlock(priv);
|
|
return rv;
|