From 361e46d6d00e6d246ffd27d3e55edf08e8b8c3f4 Mon Sep 17 00:00:00 2001 From: Jim Meyering 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 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c index 1ca3da06e9..620c482a78 100644 --- a/src/xen/xs_internal.c +++ b/src/xen/xs_internal.c @@ -1,7 +1,7 @@ /* * 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 * @@ -1367,6 +1367,9 @@ int xenStoreDomainIntroduced(virConnectPtr conn, 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; @@ -1447,6 +1450,8 @@ int xenStoreDomainReleased(virConnectPtr conn, 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); -- GitLab