Remove memory leak in calcOutput