orb: fix major leak in document event handlers