From aade299c620ed4536ac7b92790365aca3609d158 Mon Sep 17 00:00:00 2001 From: Teijo Kinnunen Date: Mon, 3 Jun 2019 13:11:07 +0300 Subject: [PATCH] CThunk: Fix assertion when CThunk object is destroyed In case the CThunk object is deleted without having called the entry() function (and thus _entry is NULL), cthunk_free_real() will fail with an assertion. --- platform/CThunk.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/CThunk.h b/platform/CThunk.h index 5bd6998ea6..288cac141e 100644 --- a/platform/CThunk.h +++ b/platform/CThunk.h @@ -64,8 +64,10 @@ public: ~CThunk() { - cthunk_free(_entry); - _entry = NULL; + if (_entry != NULL) { + cthunk_free(_entry); + _entry = NULL; + } } inline CThunk(T *instance, CCallbackSimple callback)