Skip to content

Commit

Permalink
loadLeader(): fix memleak in error code path
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault authored and github-actions[bot] committed Oct 13, 2022
1 parent aafd36d commit 8f0e2b7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mapfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,13 @@ static int loadLeader(labelLeaderObj *leader)
if(msGrowLeaderStyles(leader) == NULL)
return(-1);
initStyle(leader->styles[leader->numstyles]);
if(loadStyle(leader->styles[leader->numstyles]) != MS_SUCCESS) return(-1);
if(loadStyle(leader->styles[leader->numstyles]) != MS_SUCCESS)
{
freeStyle(leader->styles[leader->numstyles]);
free(leader->styles[leader->numstyles]);
leader->styles[leader->numstyles] = NULL;
return -1;
}
leader->numstyles++;
break;
default:
Expand Down

0 comments on commit 8f0e2b7

Please sign in to comment.