Resolve #3311888 "Memory leak with"

Closes #3311888

Merge request reports