 			swap_polygons(polygon_pointer, vertex_nb, polygon_buffer, polygon_buffer_nb);
 		}
 	}
-
-	free(polygon_buffer);
+	return;
 }
 
 /*

/*
*/
__device__
void intersection_clip_facet_with_knn(double* polygon_pointer, int& vertex_nb, int current_seed, double* seeds_pointer, int seeds_nb, int *seeds_neighbor_index, int k)
{
	
	//set a buffer pointer to store the polygon
	double* polygon_buffer = (double*)malloc(sizeof(double) * 10 * 4);
	int polygon_buffer_nb = 0;

	for (int i = 0; i < k; ++i)
	{
		int j = seeds_neighbor_index[current_seed * k + i];

			MyAtomicAdd(&SeedsInformation[current_seed * 4 + 2], temp_pos.z);
			MyAtomicAdd(&SeedsInformation[current_seed * 4 + 3], current_weight);
		}
	}
	__syncthreads();
	
	for (int i = 0; i < seeds_nb * 4; ++i)
	{
		ret_seeds[i] = SeedsInformation[i];
	}
	return;
}

