Fixed memory leak in neighborhood_arrfunc