diff --git a/cardenc/pycard.cc b/cardenc/pycard.cc index 4ae27fe..5941d0a 100644 --- a/cardenc/pycard.cc +++ b/cardenc/pycard.cc @@ -11,6 +11,7 @@ #include #include #include +#include #include #include "card.hh" @@ -122,8 +123,14 @@ static struct PyModuleDef module_def = { NULL, /* m_free */ }; +static volatile int *_dummy_malloc; + PyMODINIT_FUNC PyInit_pycard(void) { + _dummy_malloc = (int *)malloc(sizeof(int)); + *_dummy_malloc = 1; + free((void *)_dummy_malloc); + PyObject *m = PyModule_Create(&module_def); if (m == NULL) diff --git a/solvers/pysolvers.cc b/solvers/pysolvers.cc index 7066cb4..6b4d7de 100644 --- a/solvers/pysolvers.cc +++ b/solvers/pysolvers.cc @@ -15,6 +15,7 @@ #include #include #include +#include #include #ifdef WITH_CADICAL @@ -493,8 +494,14 @@ static struct PyModuleDef module_def = { NULL, /* m_free */ }; +static volatile int *_dummy_malloc; + PyMODINIT_FUNC PyInit_pysolvers(void) { + _dummy_malloc = (int *)malloc(sizeof(int)); + *_dummy_malloc = 1; + free((void *)_dummy_malloc); + PyObject *m = PyModule_Create(&module_def); if (m == NULL)