Bug #6118: Clean up list handling in image.c (drumkilla)