MCPcopy Index your code
hub / github.com/MapServer/MapServer / msFreeMap

Function msFreeMap

mapobject.c:77–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75/************************************************************************/
76
77void msFreeMap(mapObj *map) {
78 int i;
79
80 if(!map) return;
81
82 /* printf("msFreeMap(): maybe freeing map at %p count=%d.\n",map, map->refcount); */
83 if(MS_REFCNT_DECR_IS_NOT_ZERO(map)) { return; }
84 if(map->debug >= MS_DEBUGLEVEL_VV)
85 msDebug("msFreeMap(): freeing map at %p.\n",map);
86
87 msCloseConnections(map);
88
89 msFree(map->name);
90 msFree(map->shapepath);
91 msFree(map->mappath);
92
93 msFreeProjection(&(map->projection));
94 msFreeProjection(&(map->latlon));
95
96 msFreeLabelCache(&(map->labelcache));
97
98 msFree(map->imagetype);
99
100 msFreeFontSet(&(map->fontset));
101
102 msFreeSymbolSet(&map->symbolset); /* free symbols */
103 msFree(map->symbolset.filename);
104
105 freeWeb(&(map->web));
106
107 freeScalebar(&(map->scalebar));
108 freeReferenceMap(&(map->reference));
109 freeLegend(&(map->legend));
110
111 for(i=0; i<map->maxlayers; i++) {
112 if(GET_LAYER(map, i) != NULL) {
113 GET_LAYER(map, i)->map = NULL;
114 if(freeLayer((GET_LAYER(map, i))) == MS_SUCCESS)
115 free(GET_LAYER(map, i));
116 }
117 }
118 msFree(map->layers);
119
120 if(map->layerorder)
121 free(map->layerorder);
122
123 msFree(map->templatepattern);
124 msFree(map->datapattern);
125 msFreeHashItems(&(map->configoptions));
126 if(map->outputformat && map->outputformat->refcount > 0 && --map->outputformat->refcount < 1)
127 msFreeOutputFormat(map->outputformat);
128
129 for(i=0; i<map->numoutputformats; i++ ) {
130 if(map->outputformatlist[i]->refcount > 0 && --map->outputformatlist[i]->refcount < 1)
131 msFreeOutputFormat(map->outputformatlist[i]);
132 }
133 if(map->outputformatlist != NULL)
134 msFree(map->outputformatlist);

Callers 10

mainFunction · 0.85
mainFunction · 0.85
msLoadMapFromStringFunction · 0.85
mapfile.cFile · 0.85
msFreeMapServObjFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mapObj_destroyFunction · 0.85
mapObj_cloneFunction · 0.85

Calls 15

msDebugFunction · 0.85
msCloseConnectionsFunction · 0.85
msFreeFunction · 0.85
msFreeProjectionFunction · 0.85
msFreeLabelCacheFunction · 0.85
msFreeFontSetFunction · 0.85
msFreeSymbolSetFunction · 0.85
freeWebFunction · 0.85
freeScalebarFunction · 0.85
freeReferenceMapFunction · 0.85
freeLegendFunction · 0.85
freeLayerFunction · 0.85

Tested by 1

mainFunction · 0.68