Skip to content

Commit

Permalink
msLoadMap(): fix double-free related to labels (#6659)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 5, 2022
1 parent 8a0b2cd commit 7f2d651
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mapfile.c
Expand Up @@ -1594,7 +1594,6 @@ static int loadLabel(labelObj *label)
break;
case(EOF):
msSetError(MS_EOFERR, NULL, "loadLabel()");
freeLabel(label); /* free any structures allocated before EOF */
return(-1);
case(EXPRESSION):
if(loadExpression(&(label->expression)) == -1) return(-1); /* loadExpression() cleans up previously allocated expression */
Expand Down Expand Up @@ -3239,7 +3238,9 @@ int loadClass(classObj *class, layerObj *layer)
initLabel(class->labels[class->numlabels]);
class->labels[class->numlabels]->size = MS_MEDIUM; /* only set a default if the LABEL section is present */
if(loadLabel(class->labels[class->numlabels]) == -1) {
msFree(class->labels[class->numlabels]);
freeLabel(class->labels[class->numlabels]);
free(class->labels[class->numlabels]);
class->labels[class->numlabels] = NULL;
return(-1);
}
class->numlabels++;
Expand Down

0 comments on commit 7f2d651

Please sign in to comment.