Revert "Fix CID #1134974" - fix segfault

This reverts commit 75f4d83afe1604c52a4f9654fdca281f50efb484.
That was causing segfault on exit