hamano / pysmbc

libsmbclient binding for Python
http://pypi.python.org/pypi/pysmbc
GNU General Public License v2.0
28 stars 27 forks source link

Fix Some Holes In Error Checking And Potential Memory Leaks #33

Closed ldo closed 4 years ago

ldo commented 5 years ago

The following patch ldo-structured-error-checks.patch.txt reworks some routines to fix holes in error checking and potential memory leaks from error recovery.

The basic principle is, all temporary object pointers are initialized to NULL at the start, and unconditionally passed to Py_XDECREF at end. Ownership of objects being constructed is only passed from temporary to result pointers after completion of all operations without errors. Note in particular how the loop-within-a-loop is handled in the Dir.getdents() routine.

hamano commented 5 years ago

could you make pull requests?

ldo commented 4 years ago

Thank you for accepting this. Closing.