attach memory context sooner so that cleanup will work correctly

Evan Hunt requested to merge 956-fix-dnstap-test-v9_14 into v9_14

Merge request reports