Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
mingw64: Python pmapi on Windows - prevent crash when free()'ing resources #42
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
dgiagio commentedAug 20, 2015
When calling Python pmapi functions such as
pmGetChildren,pmGetInDom, etc. these functions internally allocate resources usingmalloc. Unfortunately the current code on Windows crashes whenfree'ing these resources because thefreefunction used doesn't always belong to the correctmsvcrt.dllversion.AFAIK artifacts (.exe's, .dll's, etc) compiled using mingw64 are always linked with
\Windows\System32\msvcrt.dll, but Python is not necessarily. E.g:That means that
libpcp.dll(used by pmapi Python module) is using themallocfunction frommsvcrt.dllwhile Python is using thefreefunction frommsvcrt90.dlland thus it crashes.This fix ensures that if we're on Windows platform, we always use
msvcrt.dll. On other platforms it's unchanged and keeps using the platform's libc.