I'm referring to this comment: https://github.com/bkase/r2d2b2g/blob/4328069af82f87a4890d7a8947232efd4f3be8da/android-tools/adb-bin/exports.cpp#L32
And to the fact that you are calling malloc here, instead of using ctypes-allocated objects.
Wouldn't it work with the code snippet I gave as example?