Free kernel to eliminate memory leak