Quick grep suggests the only other C (or Pyrex) extension with a likely issue with malloc directly is:
bzrlib/_bencode_pyx.pyx:263: p = <char*>malloc(maxsize)
So probably we should try making minimal fixes to both _bencode_pyx.pyx and _patience_diff_c.c and see if that fixes this particular bug.
But we also need to be careful with things that call malloc indirectly, and I don't know of a good way to find those. Perhaps an LD_PRELOAD hack?
Quick grep suggests the only other C (or Pyrex) extension with a likely issue with malloc directly is:
bzrlib/ _bencode_ pyx.pyx: 263: p = <char*> malloc( maxsize)
So probably we should try making minimal fixes to both _bencode_pyx.pyx and _patience_diff_c.c and see if that fixes this particular bug.
But we also need to be careful with things that call malloc indirectly, and I don't know of a good way to find those. Perhaps an LD_PRELOAD hack?