fixed double free(array)