@@ -2419,18 +2419,6 @@ static PyObject *get_channel_raw_bytes_complete(PyObject *self, PyObject *args)
24192419 Py_XDECREF (ref );
24202420 //fptr = fopen(file_name,"rb");
24212421
2422- #if defined(_WIN32 )
2423-
2424- HANDLE * hThreads ;
2425- DWORD * dwThreadIdArray ;
2426- hThreads = (HANDLE * ) malloc (sizeof (HANDLE ) * thread_count );
2427- dwThreadIdArray = (DWORD * ) malloc (sizeof (DWORD ) * thread_count );
2428- #else
2429-
2430- pthread_t * dwThreadIdArray = (pthread_t * ) malloc (sizeof (pthread_t ) * thread_count );
2431-
2432- #endif
2433-
24342422 PtrSignalInfo signal_info ;
24352423
24362424 is_list = PyList_Check (signals );
@@ -2511,7 +2499,19 @@ static PyObject *get_channel_raw_bytes_complete(PyObject *self, PyObject *args)
25112499 thread_count = info_count ;
25122500 }
25132501
2514- // printf("thread count %d\n", thread_count);
2502+ printf ("thread count %d\n" , thread_count );
2503+
2504+ #if defined(_WIN32 )
2505+
2506+ HANDLE * hThreads = NULL ;
2507+ DWORD * dwThreadIdArray = NULL ;
2508+ hThreads = (HANDLE * ) malloc (sizeof (HANDLE ) * thread_count );
2509+ dwThreadIdArray = (DWORD * ) malloc (sizeof (DWORD ) * thread_count );
2510+ #else
2511+
2512+ pthread_t * dwThreadIdArray = (pthread_t * ) malloc (sizeof (pthread_t ) * thread_count );
2513+
2514+ #endif
25152515
25162516 block_info = (PtrInfoBlock ) malloc (sizeof (InfoBlock ) * info_count );
25172517 if (!block_info ) {
@@ -2645,6 +2645,10 @@ static PyObject *get_channel_raw_bytes_complete(PyObject *self, PyObject *args)
26452645
26462646 free (block_info );
26472647 free (thread_info );
2648+ free (dwThreadIdArray );
2649+ #if defined(_WIN32 )
2650+ free (hThreads );
2651+ #endif
26482652 }
26492653
26502654 PyObject * inv , * inv_array , * origin ;
@@ -2717,14 +2721,9 @@ static PyObject *get_channel_raw_bytes_complete(PyObject *self, PyObject *args)
27172721 free (cache );
27182722
27192723 free (signal_info );
2720- free (dwThreadIdArray );
2721-
2724+
27222725 Py_XDECREF (InvalidationArray );
27232726
2724- #if defined(_WIN32 )
2725- free (hThreads );
2726- #endif
2727-
27282727 return out ;
27292728 }
27302729}
0 commit comments