* Generic function to free the imageObj */
| 846 | * Generic function to free the imageObj |
| 847 | */ |
| 848 | void msFreeImage(imageObj *image) |
| 849 | { |
| 850 | if (image) |
| 851 | { |
| 852 | if(MS_RENDERER_PLUGIN(image->format)) { |
| 853 | rendererVTableObj *renderer = image->format->vtable; |
| 854 | tileCacheObj *next,*cur = image->tilecache; |
| 855 | while(cur) { |
| 856 | msFreeImage(cur->image); |
| 857 | next = cur->next; |
| 858 | free(cur); |
| 859 | cur = next; |
| 860 | } |
| 861 | image->ntiles = 0; |
| 862 | renderer->freeImage(image); |
| 863 | } else if( MS_RENDERER_IMAGEMAP(image->format) ) |
| 864 | msFreeImageIM(image); |
| 865 | else if( MS_RENDERER_RAWDATA(image->format) ) |
| 866 | msFree(image->img.raw_16bit); |
| 867 | else |
| 868 | msSetError(MS_MISCERR, "Unknown image type", |
| 869 | "msFreeImage()"); |
| 870 | |
| 871 | if (image->imagepath) |
| 872 | free(image->imagepath); |
| 873 | if (image->imageurl) |
| 874 | free(image->imageurl); |
| 875 | |
| 876 | if( --image->format->refcount < 1 ) |
| 877 | msFreeOutputFormat( image->format ); |
| 878 | |
| 879 | image->imagepath = NULL; |
| 880 | image->imageurl = NULL; |
| 881 | |
| 882 | msFree( image->img_mask ); |
| 883 | image->img_mask= NULL; |
| 884 | |
| 885 | msFree( image ); |
| 886 | } |
| 887 | } |
| 888 | |
| 889 | /* |
| 890 | ** Return an array containing all the layer's index given a group name. |
no test coverage detected