[libvirt] [PATCH] Ensure to zero out the virDomainBlockJobInfo arg

From: "Daniel P. Berrange" <berrange@redhat.com> The virDomainGetBlockJobInfo method did not zero out the virDomainBlockJobInfo pointer arg, so when block jobs were not active it would return garbage for the bandwidth/cur/end fields. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/libvirt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libvirt.c b/src/libvirt.c index eff44eb..a2df53d 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -20850,6 +20850,8 @@ int virDomainGetBlockJobInfo(virDomainPtr dom, const char *disk, virCheckNonNullArgGoto(disk, error); virCheckNonNullArgGoto(info, error); + memset(info, 0, sizeof(*info)); + if (conn->driver->domainGetBlockJobInfo) { int ret; ret = conn->driver->domainGetBlockJobInfo(dom, disk, info, flags); -- 1.8.3.1

On 12/02/2013 09:57 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
The virDomainGetBlockJobInfo method did not zero out the virDomainBlockJobInfo pointer arg, so when block jobs were not active it would return garbage for the bandwidth/cur/end fields.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/libvirt.c | 2 ++ 1 file changed, 2 insertions(+)
ACK.
diff --git a/src/libvirt.c b/src/libvirt.c index eff44eb..a2df53d 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -20850,6 +20850,8 @@ int virDomainGetBlockJobInfo(virDomainPtr dom, const char *disk, virCheckNonNullArgGoto(disk, error); virCheckNonNullArgGoto(info, error);
+ memset(info, 0, sizeof(*info)); + if (conn->driver->domainGetBlockJobInfo) { int ret; ret = conn->driver->domainGetBlockJobInfo(dom, disk, info, flags);
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Daniel P. Berrange
-
Eric Blake