Fixed some possible memory leakages.  Refs #7362.
Merge branch 'feature/7362_enhance_editinstrument' into develop