diff options
author | Guido van Rossum <guido@python.org> | 2002-10-18 14:15:33 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-10-18 14:15:33 (GMT) |
commit | 617080b6cfc291661312825a9332e086d4c5bc74 (patch) | |
tree | 8f093ae15cd984c2056bba401dc817467a217ee5 | |
parent | 3930bc35d0aeb5a111793da634806ed6dec2161e (diff) | |
download | cpython-617080b6cfc291661312825a9332e086d4c5bc74.zip cpython-617080b6cfc291661312825a9332e086d4c5bc74.tar.gz cpython-617080b6cfc291661312825a9332e086d4c5bc74.tar.bz2 |
Fix (real! :-) memory leaks in half_cmp and half_binop.
Perhaps found by NealN and valgrind. Will forward port.
-rw-r--r-- | Objects/classobject.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c index f698cc3..ff6f11e 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -1357,6 +1357,7 @@ half_binop(PyObject *v, PyObject *w, char *opname, binaryfunc thisfunc, args = Py_BuildValue("(O)", w); if (args == NULL) { + Py_DECREF(coercefunc); return NULL; } coerced = PyEval_CallObject(coercefunc, args); @@ -1553,8 +1554,10 @@ half_cmp(PyObject *v, PyObject *w) } args = Py_BuildValue("(O)", w); - if (args == NULL) + if (args == NULL) { + Py_DECREF(cmp_func); return -2; + } result = PyEval_CallObject(cmp_func, args); Py_DECREF(args); |