updated for version 7.3.1100
Problem: Python: a few more memory problems.
Solution: Add and remove Py_XDECREF(). (ZyX)
diff --git a/src/if_py_both.h b/src/if_py_both.h
index 73fa56c..99fdd80 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -1236,6 +1236,7 @@
if (*key == NUL)
{
RAISE_NO_EMPTY_KEYS;
+ Py_XDECREF(todecref);
return -1;
}
@@ -1254,11 +1255,15 @@
hi = hash_find(&dict->dv_hashtab, di->di_key);
hash_remove(&dict->dv_hashtab, hi);
dictitem_free(di);
+ Py_XDECREF(todecref);
return 0;
}
if (ConvertFromPyObject(valObject, &tv) == -1)
+ {
+ Py_XDECREF(todecref);
return -1;
+ }
if (di == NULL)
{
@@ -2505,11 +2510,8 @@
PyObject *todecref;
if ((val = StringToChars(valObject, &todecref)))
- {
r = set_option_value_for(key, 0, val, opt_flags,
self->opt_type, self->from);
- Py_XDECREF(todecref);
- }
else
r = -1;
}