Skip to content

Commit

Permalink
d.legend.vect: Initialize title size (OSGeo#3095)
Browse files Browse the repository at this point in the history
Later test (line 270) uses title width to compute background size regardless of title presence, but original code initialized title_w only when title was set.

This fixes occasional extra wide legend background rectangle.

Identified by valgrind as: Conditional jump or move depends on uninitialized value(s).
  • Loading branch information
wenzeslaus authored Nov 20, 2023
1 parent a21ecf1 commit 6a4b46d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions display/d.legend.vect/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ void draw(char *file_name, double LL, double LT, char *title, int cols,

/* Draw title */
title_h = 0;
title_w = 0;
if (strlen(title) > 0) {
D_font(tit_font);
D_text_size(tit_size, tit_size);
Expand Down

0 comments on commit 6a4b46d

Please sign in to comment.