From: kramm Date: Thu, 8 Apr 2004 08:52:44 +0000 (+0000) Subject: fixed a rather nasty memory allocation bug, where a PyLong had it's X-Git-Tag: stable_core_1~6 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=f44240dc075f338630e1f02de3baca03f8806da8 fixed a rather nasty memory allocation bug, where a PyLong had it's reference count decreased (and was therefore freed) even though it was still used in a PyDict. Good riddance. --- diff --git a/lib/python/tagmap.c b/lib/python/tagmap.c index 0dbad9f..0c9b8a6 100644 --- a/lib/python/tagmap.c +++ b/lib/python/tagmap.c @@ -37,12 +37,15 @@ typedef struct { PyObject* tagmap_new() { PyObject* self = (PyObject*)PyObject_New(TagMapObject, &TagMapClass); - mylog("+%08x(%d) tagmap_new", (int)self, self->ob_refcnt); TagMapObject*tagmap = (TagMapObject*)self; tagmap->obj2id = PyDict_New(); tagmap->id2obj = PyDict_New(); tagmap->objlist = PyList_New(0); tagmap->currentID = 0; //IDs start at 1 + mylog("+%08x(%d) tagmap_new %08x(%d) %08x(%d), %08x(%d)", (int)self, self->ob_refcnt, + tagmap->obj2id, tagmap->obj2id->ob_refcnt , + tagmap->id2obj, tagmap->id2obj->ob_refcnt , + tagmap->objlist, tagmap->objlist->ob_refcnt); return self; } @@ -54,7 +57,6 @@ int tagmap_obj2id(PyObject* self, PyObject* obj) if(id == 0) return -1; int _id = PyLong_AsLong(id); - Py_DECREF(id); return _id; }