From fefc7d9b495441cf074a047f77a74ff4e50ead3c Mon Sep 17 00:00:00 2001 From: Philipp Moritz Date: Tue, 7 Feb 2017 11:17:11 -0800 Subject: [PATCH] fix segfault in photon.Task (#253) --- src/common/lib/python/common_extension.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); }