From e41457913fe0b69db27e1c0e17a32736d80f8267 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 31 Jan 2010 10:12:26 +0100 Subject: [PATCH] Fixed a memory leak in the cache module. --- core_pe/modules/cache/cache.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core_pe/modules/cache/cache.c b/core_pe/modules/cache/cache.c index a808b000..5f4f4edb 100644 --- a/core_pe/modules/cache/cache.c +++ b/core_pe/modules/cache/cache.c @@ -33,6 +33,7 @@ cache_string_to_colors(PyObject *self, PyObject *args) char *s; Py_ssize_t char_count, color_count, i; PyObject *result; + if (!PyArg_ParseTuple(args, "s#", &s, &char_count)) { return NULL; } @@ -62,10 +63,10 @@ cache_string_to_colors(PyObject *self, PyObject *args) return NULL; } color_tuple = PyTuple_Pack(3, pr, pg, pb); + Py_DECREF(pr); + Py_DECREF(pg); + Py_DECREF(pb); if (color_tuple == NULL) { - Py_DECREF(pr); - Py_DECREF(pg); - Py_DECREF(pb); Py_DECREF(result); return NULL; }