On 02/14/2011 06:25 PM, Eric Blake wrote:
* src/libvirt.c (virDomainMemoryStats): Check domain before flags.
---
Another valid bug found by clang. User's generally should't call
virDomainMemoryStats(NULL,...), but we don't forbid it elsewhere, and
doing so is not supposed to crash libvirt. All other flags checks in
this file occur after validating the object first.
src/libvirt.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 479a9b5..f65cc24 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -4411,12 +4411,6 @@ int virDomainMemoryStats (virDomainPtr dom,
virDomainMemoryStatPtr stats,
VIR_DOMAIN_DEBUG(dom, "stats=%p, nr_stats=%u", stats, nr_stats);
- if (flags != 0) {
- virLibDomainError(VIR_ERR_INVALID_ARG,
- _("flags must be zero"));
- goto error;
- }
-
virResetLastError();
if (!VIR_IS_CONNECTED_DOMAIN (dom)) {
@@ -4424,6 +4418,12 @@ int virDomainMemoryStats (virDomainPtr dom,
virDomainMemoryStatPtr stats,
virDispatchError(NULL);
return -1;
}
+ if (flags != 0) {
+ virLibDomainError(VIR_ERR_INVALID_ARG,
+ _("flags must be zero"));
+ goto error;
+ }
+
if (!stats || nr_stats == 0)
return 0;
ACK
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list