[libvirt] [PATCH] xs_internal.c: don't use a negative value as allocation size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As the log message says...

>From 6d7abfb983328fbe34bd4404d8fafda100e8098f Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
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@xxxxxxxxxx>
  */
@@ -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;
     }
--
1.7.0.rc1.149.g0b0b7

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]