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);