Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Usual tabs/spaces/indent stuff * Make use of the fact that __new__ ensures that self->obj is never NULL * Fix memory leak when PyObject_GetAttr(self, py__parent__) raised something else then AttributeError. Before 'result' was leaking. * The 'err:' section returned 'result' in case of erros. Due to the decref before 'result' became an invalid pointer. Returning this pointer would have let to a segfault. The proper way to signal an error is by returning a NULL pointer. As it is done now. * Prevent segfault if the return value of PyObject_GetAttr(self, py__parent__) had an refcount of 1. In that case it Py_DECREF came too early and an access of this pointer later would have lead to segfault. Now the reference is kept alive until the end of the function. Yes this complicated the other assignments to self a bit.
- Loading branch information
1 parent
6618e95
commit acaee01
Showing
1 changed file
with
49 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters