Fix a "free(): error: chunk is already free" under certain circumstances that include circular dependencies.
Fix a "free(): error: chunk is already free" under certain
circumstances that include circular dependencies.

PR:                     bin/91789
PR submitted by:        Frank Behrens <frank@pinky.sax.de>
Patch submitted by:     Divacky Roman <xdivac02@stud.fit.vutbr.cz>

jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase