From 89d2c50a648e3affd81ceb24e332bbd60de2b75d Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Thu, 30 Apr 2009 19:18:17 +0200 Subject: Fixed a bug causing segv When calling dmidecode_get_xml(...) several times could cause a crash due to the opt.dmiversion_n pointer being freed by a mistake when the generated dmixml_n got freed later on in the function. Also fixed an assertion typo --- src/dmidecodemodule.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/dmidecodemodule.c') diff --git a/src/dmidecodemodule.c b/src/dmidecodemodule.c index 8c3a2b9..05689b0 100644 --- a/src/dmidecodemodule.c +++ b/src/dmidecodemodule.c @@ -158,11 +158,11 @@ xmlNode *dmidecode_get_xml(PyObject *self, const char *section) u8 *buf; xmlNode *dmixml_n = xmlNewNode(NULL, (xmlChar *) "dmidecode"); - assert( dmixml != NULL ); + assert( dmixml_n != NULL ); // Append DMI version info if( opt.dmiversion_n != NULL ) { - xmlAddChild(dmixml_n, opt.dmiversion_n); + xmlAddChild(dmixml_n, xmlCopyNode(opt.dmiversion_n, 1)); } const char *f = opt.dumpfile ? PyString_AsString(opt.dumpfile) : opt.devmem; -- cgit