Errors seen in LOGS/libssh2-python-0.7.1-4.fc17

This is a summary of errors seen when compiling with an experimental static analysis tool

Raw build logs can be seen here

Reference count too low

Code paths in which the reference count of an object is left too low. This could lead to the object being deallocated too early, triggering segfaults when later accessed. Over repeated calls, these errors could accumulate, increasing the likelihood of a segfault.

src/session.c SSH2_Session_New ob_refcnt of return value is 1 too low

Reference leaks

Code paths in which the reference count of an object is left too high, leading to memory leaks

src/session.c session_scp_recv ob_refcnt of '*_exc' is 1 too high
src/session.c session_scp_recv ob_refcnt of new ref from call to _Py_BuildValue_SizeT is 1 too high
src/session.c session_direct_tcpip ob_refcnt of '*_exc' is 1 too high
src/session.c session_direct_tcpip ob_refcnt of new ref from call to _Py_BuildValue_SizeT is 1 too high
src/session.c session_startup ob_refcnt of '*_exc' is 1 too high
src/session.c session_startup ob_refcnt of new ref from call to _Py_BuildValue_SizeT is 1 too high
src/session.c session_userauth_keyboard_interactive ob_refcnt of _Py_NoneStruct is 1 too high
src/session.c session_userauth_keyboard_interactive ob_refcnt of '*_exc' is 1 too high
src/session.c session_userauth_keyboard_interactive ob_refcnt of new ref from call to _Py_BuildValue_SizeT is 1 too high
src/session.c session_userauth_keyboard_interactive ob_refcnt of return value is 1 too high
src/session.c session_userauth_publickey_fromfile ob_refcnt of '*_exc' is 1 too high
src/session.c session_userauth_publickey_fromfile ob_refcnt of new ref from call to _Py_BuildValue_SizeT is 1 too high
src/session.c session_method_pref ob_refcnt of '*_exc' is 1 too high
src/session.c session_method_pref ob_refcnt of new ref from call to _Py_BuildValue_SizeT is 1 too high
src/session.c session_scp_send ob_refcnt of '*_exc' is 1 too high
src/session.c session_scp_send ob_refcnt of new ref from call to _Py_BuildValue_SizeT is 1 too high
src/session.c session_channel ob_refcnt of '*_exc' is 1 too high
src/session.c session_channel ob_refcnt of new ref from call to _Py_BuildValue_SizeT is 1 too high
src/session.c session_userauth_publickey ob_refcnt of '*_exc' is 1 too high
src/session.c session_userauth_publickey ob_refcnt of new ref from call to _Py_BuildValue_SizeT is 1 too high
src/session.c session_forward_listen ob_refcnt of '*_exc' is 1 too high
src/session.c session_forward_listen ob_refcnt of new ref from call to _Py_BuildValue_SizeT is 1 too high
src/session.c session_userauth_password ob_refcnt of _Py_NoneStruct is 1 too high
src/session.c session_userauth_password ob_refcnt of '*_exc' is 1 too high
src/session.c session_userauth_password ob_refcnt of new ref from call to _Py_BuildValue_SizeT is 1 too high
src/session.c session_userauth_password ob_refcnt of return value is 1 too high
src/session.c session_userauth_hostbased_fromfile ob_refcnt of '*_exc' is 1 too high
src/session.c session_userauth_hostbased_fromfile ob_refcnt of new ref from call to _Py_BuildValue_SizeT is 1 too high
src/session.c session_disconnect ob_refcnt of '*_exc' is 1 too high
src/session.c session_disconnect ob_refcnt of new ref from call to _Py_BuildValue_SizeT is 1 too high

Reference count too low within an initialization routine

Code paths in which the reference count of an object is too low, but within an initialization routine, and thus likely to only happen once

src/ssh2.c initlibssh2 ob_refcnt of '*module' is 1 too low
src/ssh2.c initlibssh2 ob_refcnt of '*SSH2_Error.1' is 1 too low

Segfaults within error-handling paths

Code paths in error-handling that will lead to a segmentatation fault (e.g. under low memory conditions)

src/session.c x11_callback dereferencing NULL (MEM[(struct PyObject *)channel_obj].ob_refcnt) at src/session.c:621
src/session.c session_scp_recv calling PyObject_SetAttrString with NULL as argument 1 (_exc) at src/session.c:703
src/session.c session_direct_tcpip calling PyObject_SetAttrString with NULL as argument 1 (_exc) at src/session.c:763
src/session.c session_startup calling PyObject_SetAttrString with NULL as argument 1 (_exc) at src/session.c:101
src/session.c session_userauth_keyboard_interactive calling PyObject_SetAttrString with NULL as argument 1 (_exc) at src/session.c:497
src/session.c session_userauth_publickey_fromfile calling PyObject_SetAttrString with NULL as argument 1 (_exc) at src/session.c:272
src/session.c session_method_pref calling PyObject_SetAttrString with NULL as argument 1 (_exc) at src/session.c:529
src/session.c session_scp_send calling PyObject_SetAttrString with NULL as argument 1 (_exc) at src/session.c:725
src/session.c session_channel calling PyObject_SetAttrString with NULL as argument 1 (_exc) at src/session.c:685
src/session.c session_userauth_publickey calling PyObject_SetAttrString with NULL as argument 1 (_exc) at src/session.c:339
src/session.c session_forward_listen calling PyObject_SetAttrString with NULL as argument 1 (_exc) at src/session.c:784
src/session.c session_userauth_password calling PyObject_SetAttrString with NULL as argument 1 (_exc) at src/session.c:246
src/session.c session_userauth_hostbased_fromfile calling PyObject_SetAttrString with NULL as argument 1 (_exc) at src/session.c:379
src/session.c session_disconnect calling PyObject_SetAttrString with NULL as argument 1 (_exc) at src/session.c:128