Fixed memory leaks in Image.cc.