Log messages before freeing data