diff --git a/src/common/lib/python/common_extension.c b/src/common/lib/python/common_extension.c index 4d43de959..d00b66944 100644 --- a/src/common/lib/python/common_extension.c +++ b/src/common/lib/python/common_extension.c @@ -323,7 +323,9 @@ static int PyTask_init(PyTask *self, PyObject *args, PyObject *kwds) { } static void PyTask_dealloc(PyTask *self) { - free_task_spec(self->spec); + if (self->spec != NULL) { + free_task_spec(self->spec); + } Py_TYPE(self)->tp_free((PyObject *) self); }