Fix memory leak in GifEncoder