summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sommerseth <davids@redhat.com>2009-04-30 19:18:17 +0200
committerDavid Sommerseth <davids@redhat.com>2009-04-30 19:18:17 +0200
commit89d2c50a648e3affd81ceb24e332bbd60de2b75d (patch)
tree88beff79de7677abb8efe16d2da758f06b4d4ed9
parent268687f5b525ce4bdb1becd5a5207bfc2ced8340 (diff)
downloadpython-dmidecode-89d2c50a648e3affd81ceb24e332bbd60de2b75d.tar.gz
python-dmidecode-89d2c50a648e3affd81ceb24e332bbd60de2b75d.tar.xz
python-dmidecode-89d2c50a648e3affd81ceb24e332bbd60de2b75d.zip
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
-rw-r--r--src/dmidecodemodule.c4
1 files changed, 2 insertions, 2 deletions
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;