From 0dc23afb0ca41cf540e081e947de973ee125cb99 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 16 May 2008 09:30:10 +0000 Subject: [PATCH] avoid a double-free bug * src/qemu_conf.c (qemudParseXML): Ensure that "obj" is either NULL or a valid malloc'd pointer before we might "goto error" where it is freed. --- ChangeLog | 7 +++++++ src/qemu_conf.c | 1 + 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7a455b9f10..1d524f4682 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Fri May 16 11:29:30 CEST 2008 Jim Meyering + + avoid a double-free bug + * src/qemu_conf.c (qemudParseXML): Ensure that "obj" is either + NULL or a valid malloc'd pointer before we might "goto error" + where it is freed. + Thu May 15 16:06:08 EST 2008 Daniel P. Berrange * src/qemu_conf.c: Remove use of strcmp() diff --git a/src/qemu_conf.c b/src/qemu_conf.c index 458f5dfe23..1a7ab46350 100644 --- a/src/qemu_conf.c +++ b/src/qemu_conf.c @@ -1736,6 +1736,7 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn, } else { strcpy(def->os.type, (const char *)obj->stringval); xmlXPathFreeObject(obj); + obj = NULL; } if (!virCapabilitiesSupportsGuestOSType(driver->caps, def->os.type)) { -- GitLab