BUG-6757: revert fix for BUG-4456
The fix has introduced a massive memory leak, which causes
all of temporary build objects to be retained in the final
SchemaContext.
Instead of the leak, add an explicit guard to detect
extensions (transitively) referencing themselves.
Change-Id: If90a4f9420866a6392ce97c71837915fa41ae0c8
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
e5226bf4ddd7a42aa13c392b2fc4d02d27ae2f74)
(cherry picked from commit
91f43b1ce6453fef9e04e6673e7637fb5dba8b38)