
On Tue, Feb 02, 2010 at 12:23:04PM +0100, Jim Meyering wrote:
As the log message says...
From 6d7abfb983328fbe34bd4404d8fafda100e8098f Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Tue, 2 Feb 2010 12:22:17 +0100 Subject: [PATCH] xs_internal.c: don't use a negative value as allocation size
* src/xen/xs_internal.c (xenStoreDomainIntroduced): Don't use -1 as an allocation size upon xenStoreNumOfDomains failure. (xenStoreDomainReleased): Likewise. --- src/xen/xs_internal.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c index 1ca3da0..620c482 100644 --- a/src/xen/xs_internal.c +++ b/src/xen/xs_internal.c @@ -1,9 +1,9 @@ /* * xs_internal.c: access to Xen Store * - * Copyright (C) 2006, 2009 Red Hat, Inc. + * Copyright (C) 2006, 2009-2010 Red Hat, Inc. * * See COPYING.LIB for the License of this software * * Daniel Veillard <veillard@redhat.com> */ @@ -1365,10 +1365,13 @@ int xenStoreDomainIntroduced(virConnectPtr conn,
xenUnifiedPrivatePtr priv = opaque;
retry: new_domain_cnt = xenStoreNumOfDomains(conn); + if (new_domain_cnt < 0) + return -1; + if( VIR_ALLOC_N(new_domids,new_domain_cnt) < 0 ) { virReportOOMError(NULL); return -1; } nread = xenStoreDoListDomains(conn, priv, new_domids, new_domain_cnt); @@ -1445,10 +1448,12 @@ int xenStoreDomainReleased(virConnectPtr conn,
if(!priv->activeDomainList->count) return 0;
retry: new_domain_cnt = xenStoreNumOfDomains(conn); + if (new_domain_cnt < 0) + return -1;
if( VIR_ALLOC_N(new_domids,new_domain_cnt) < 0 ) { virReportOOMError(NULL); return -1; }
Looks right, ACK thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/