]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
interface_conf.c: don't use a negative value as allocation size
authorJim Meyering <meyering@redhat.com>
Tue, 2 Feb 2010 19:54:01 +0000 (20:54 +0100)
committerJim Meyering <meyering@redhat.com>
Wed, 3 Feb 2010 14:47:04 +0000 (15:47 +0100)
* src/conf/interface_conf.c (virInterfaceDefParseProtoIPv4): If
virXPathNodeSet returns -1, indicate failure by returning -1 right away.
(virInterfaceDefParseProtoIPv6): Likewise.

src/conf/interface_conf.c

index 8a17ed626173b2342d8b611c47188c2cf34f0e84..510df81307d6278652fe6c56b5045ae961daf43d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * interface_conf.c: interfaces XML handling
  *
- * Copyright (C) 2006-2009 Red Hat, Inc.
+ * Copyright (C) 2006-2010 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -320,6 +320,8 @@ virInterfaceDefParseProtoIPv4(virConnectPtr conn, virInterfaceProtocolDefPtr def
     }
 
     nIpNodes = virXPathNodeSet(conn, "./ip", ctxt, &ipNodes);
+    if (nIpNodes < 0)
+        return -1;
     if (ipNodes == NULL)
         return 0;
 
@@ -377,6 +379,8 @@ virInterfaceDefParseProtoIPv6(virConnectPtr conn, virInterfaceProtocolDefPtr def
     }
 
     nIpNodes = virXPathNodeSet(conn, "./ip", ctxt, &ipNodes);
+    if (nIpNodes < 0)
+        return -1;
     if (ipNodes == NULL)
         return 0;