Skip to content

Commit

Permalink
Fix a memory leak in freeClass() exposed by valgrind's memcheck
Browse files Browse the repository at this point in the history
In `msGrowClassLabels()` memory is assigned to
`class->labels[class->numlabels]` but was only freed to
`class->numstyles-1` in `freeClass()`.  This fix ensures the last
label is freed.
  • Loading branch information
Homme Zwaagstra committed Jul 4, 2013
1 parent 3745e3c commit 4b90c24
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mapfile.c
Expand Up @@ -3205,7 +3205,7 @@ int freeClass(classObj *class)
}
msFree(class->styles);

for(i=0; i<class->numlabels; i++) { /* each label */
for(i=0; i<=class->numlabels; i++) { /* each label */
if(class->labels[i]!=NULL) {
if(freeLabel(class->labels[i]) == MS_SUCCESS) {
msFree(class->labels[i]);
Expand Down

0 comments on commit 4b90c24

Please sign in to comment.