Here's one way to solve this. Another would be to change the way virXPathNodeSet works, but there are several other uses of it. >From 75108240911a1ad943e0bde8ba9ade92ea216f60 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@xxxxxxxxxx> Date: Tue, 2 Feb 2010 20:54:01 +0100 Subject: [PATCH] interface_conf.c: don't use a negative value as allocation size * src/conf/interface_conf.c (virInterfaceDefParseProtoIPv4): If virXPathNodeSet returns -1, indicate failure by returning -1 right away. (virInterfaceDefParseProtoIPv6): Likewise. --- src/conf/interface_conf.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c index 8a17ed6..510df81 100644 --- a/src/conf/interface_conf.c +++ b/src/conf/interface_conf.c @@ -1,9 +1,9 @@ /* * 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 * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. @@ -318,10 +318,12 @@ virInterfaceDefParseProtoIPv4(virConnectPtr conn, virInterfaceProtocolDefPtr def if (ret != 0) return(ret); } nIpNodes = virXPathNodeSet(conn, "./ip", ctxt, &ipNodes); + if (nIpNodes < 0) + return -1; if (ipNodes == NULL) return 0; if (VIR_ALLOC_N(def->ips, nIpNodes) < 0) { virReportOOMError(conn); @@ -375,10 +377,12 @@ virInterfaceDefParseProtoIPv6(virConnectPtr conn, virInterfaceProtocolDefPtr def if (ret != 0) return(ret); } nIpNodes = virXPathNodeSet(conn, "./ip", ctxt, &ipNodes); + if (nIpNodes < 0) + return -1; if (ipNodes == NULL) return 0; if (VIR_ALLOC_N(def->ips, nIpNodes) < 0) { virReportOOMError(conn); -- 1.7.0.rc1.167.gdb08 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list