@@ -1156,12 +1156,12 @@ function_return function_py_interface_invoke(function func, function_impl impl,
11561156 loader_impl_py py_impl = loader_impl_get (py_func -> impl );
11571157 PyGILState_STATE gstate = PyGILState_Ensure ();
11581158 PyObject * tuple_args ;
1159- void * * values ;
1159+ PyObject * * values ;
11601160
11611161 /* Allocate dynamically more space for values in case of variable arguments */
11621162 if (args_size > signature_args_size || py_func -> values == NULL )
11631163 {
1164- values = malloc (sizeof (void * ) * args_size );
1164+ values = malloc (sizeof (PyObject * ) * args_size );
11651165 }
11661166 else
11671167 {
@@ -1741,6 +1741,7 @@ int py_loader_impl_execution_path(loader_impl impl, const loader_naming_path pat
17411741loader_impl_py_handle py_loader_impl_handle_create (size_t size )
17421742{
17431743 loader_impl_py_handle py_handle = malloc (sizeof (struct loader_impl_py_handle_type ));
1744+ size_t iterator ;
17441745
17451746 if (py_handle == NULL )
17461747 {
@@ -1757,6 +1758,12 @@ loader_impl_py_handle py_loader_impl_handle_create(size_t size)
17571758 return NULL ;
17581759 }
17591760
1761+ for (iterator = 0 ; iterator < size ; ++ iterator )
1762+ {
1763+ py_handle -> modules [iterator ].instance = NULL ;
1764+ py_handle -> modules [iterator ].name = NULL ;
1765+ }
1766+
17601767 return py_handle ;
17611768}
17621769
@@ -1779,7 +1786,10 @@ void py_loader_impl_handle_destroy(loader_impl_py_handle py_handle)
17791786 /* C API it looks like is not needed */
17801787 /*PyObject_Del(py_handle->modules[iterator].instance);*/
17811788
1782- PyObject_DelItem (system_modules , py_handle -> modules [iterator ].name );
1789+ if (py_handle -> modules [iterator ].name != NULL )
1790+ {
1791+ PyObject_DelItem (system_modules , py_handle -> modules [iterator ].name );
1792+ }
17831793
17841794 Py_XDECREF (py_handle -> modules [iterator ].instance );
17851795 Py_XDECREF (py_handle -> modules [iterator ].name );
0 commit comments