From ccd2ce2297a810fcd0e4b06975e2c728288926a8 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 19 Aug 2021 20:17:17 +0000 Subject: [PATCH] added a comment to HawkStd::SourceString::close() --- hawk/lib/HawkStd.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hawk/lib/HawkStd.cpp b/hawk/lib/HawkStd.cpp index 745845f0..a398ad26 100644 --- a/hawk/lib/HawkStd.cpp +++ b/hawk/lib/HawkStd.cpp @@ -1483,6 +1483,9 @@ int HawkStd::SourceString::close (Data& io) { if (io.isMaster()) { + // free the resources and nullify this->_hawk in particular + // to prevent this object from outliving the hawk instance pointed to + // by this->_hawk. HAWK_ASSERT (this->_hawk != HAWK_NULL); HAWK_ASSERT (this->str != HAWK_NULL); hawk_freemem (this->_hawk, this->str);