summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Sommerseth <davids@redhat.com>2009-06-19 11:16:08 +0200
committerDavid Sommerseth <davids@redhat.com>2009-06-19 11:16:08 +0200
commit9c651823c9d4bb918c7b7bb618a3a6275ee22619 (patch)
treedce9590b7c3111b45eedebc7ae0d6ff8be0b570b /src
parentd7376531310a92837dff47f9b0b130bb529c490b (diff)
downloadpython-dmidecode-9c651823c9d4bb918c7b7bb618a3a6275ee22619.tar.gz
python-dmidecode-9c651823c9d4bb918c7b7bb618a3a6275ee22619.tar.xz
python-dmidecode-9c651823c9d4bb918c7b7bb618a3a6275ee22619.zip
Fixed incorrectly Py_DECREC() on Py_None values
Diffstat (limited to 'src')
-rw-r--r--src/xmlpythonizer.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/xmlpythonizer.c b/src/xmlpythonizer.c
index 6704d1b..ba018eb 100644
--- a/src/xmlpythonizer.c
+++ b/src/xmlpythonizer.c
@@ -748,9 +748,11 @@ char *_get_key_value(char *key, size_t buflen, ptzMAP *map_p, xmlXPathContext *x
* @param PyObject* Pointer to the Python value
*/
-#define PyADD_DICT_VALUE(p, k, v) { \
- PyDict_SetItemString(p, k, v); \
- Py_DECREF(v); \
+#define PyADD_DICT_VALUE(p, k, v) { \
+ PyDict_SetItemString(p, k, v); \
+ if( v != Py_None ) { \
+ Py_DECREF(v); \
+ } \
}