Skip to content

Commit

Permalink
Fix Resource Leak issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubham Vasudeo Desai committed Jan 16, 2025
1 parent 7446101 commit 8a9fb1c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion display/d.barscale/draw_scale.c
Original file line number Diff line number Diff line change
Expand Up @@ -634,8 +634,10 @@ int draw_scale(double east, double north, int length, int seg, int units,
}
D_stroke();

if (fontsize < 0)
if (fontsize < 0) {
G_free(label);
return 0;
}

/* draw the distance + units text */

Expand Down Expand Up @@ -676,6 +678,7 @@ int draw_scale(double east, double north, int length, int seg, int units,
D_pos_abs(x_pos + 5 - (tr - tl), y_pos + ysize / 2 + (tt - tb) / 2);
D_text(label);
}
G_free(label);

return 0;
}

0 comments on commit 8a9fb1c

Please sign in to comment.