Program using pyao (in Thread, but probabelly everywhere) else crashed or after end emited big dump. It could be hidden by exporting MALLOC_CHECK_="0", but sometimes lead to Segfault too. All went good, until value returned from ao.AudioDevice() was disposed by Python. Problem is caused by allocating object by PyObject_NEW(...), but deallocatind by PyMem_DEL(self) where PyObject_FREE(self) should be used. Did worked in Python < 2.5 (as the DEL and FREE was the same), in Python.2.5 is not longer valid such mixing. *** glibc detected *** /usr/bin/python: double free or corruption (out): 0xb7bf8110 *** ======= Backtrace: ========= /lib/libc.so.6[0xb7cdea00] /lib/libc.so.6(cfree+0x89)[0xb7ce06f9] /usr/lib/python2.5/site-packages/aomodule.so[0xb7f09002] ======= Memory map: ======== 08048000-08049000 r-xp 00000000 08:03 4523168 /usr/bin/python2.5 08049000-0804a000 r--p 00000000 08:03 4523168 /usr/bin/python2.5 ======= Backtrace: ========= /lib/libc.so.6[0xb7cf2a00] /usr/lib/python2.5/site-packages/aomodule.so[0xb7f1d002] /usr/lib/libpython2.5.so.1.0(PyString_Type+0x0)[0xb7efa000] Reproducible: Always Steps to Reproduce: 1.in Python program use some_var=ao.AudioDevice(...) 2.exit the scope of some_var (by terminating Thread or the whole Program), so some_var is deallocated by Python 3.see the crash Actual Results: segfault/Abort + Backtrace Dump Expected Results: normal disposing of object See http://docs.python.org/whatsnew/ports.html for explanation See http://lists.xensource.com/archives/html/xen-devel/2007-01/msg01362.html for similar problem solved Solution is really simple and i include a pach for it (but i do not know, how to fix ebuild to accept the patch, so please help) The patch solves the problem: diff -ru pyao-0.82/src/aomodule.c pyao-0.82.ok/src/aomodule.c --- pyao-0.82/src/aomodule.c|---2003-07-24 08:52:59.000000000 +0200 +++ pyao-0.82.ok/src/aomodule.c|2009-02-04 03:22:17.000000000 +0100 @@ -150,7 +150,7 @@ py_ao_dealloc(ao_Object *self) { ao_close(self->dev); - PyMem_DEL(self); + PyObject_FREE(self); } static PyObject *
Created attachment 180876 [details, diff] patch for this bug
+ 23 Apr 2009; Patrick Lauer <patrick@gentoo.org> + +files/pyao-fix-deallocation.patch, +pyao-0.82-r1.ebuild: + Small fix for >=python-2.5. Thanks to gilhad for the patch. Fixes #257550