From 6a4b46d6dcb0e3b3d0bca18678c950ee748ba4c9 Mon Sep 17 00:00:00 2001 From: Vaclav Petras Date: Mon, 20 Nov 2023 14:12:53 -0500 Subject: [PATCH] d.legend.vect: Initialize title size (#3095) 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). --- display/d.legend.vect/draw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/display/d.legend.vect/draw.c b/display/d.legend.vect/draw.c index 3df05dfc3a1..516a23a45a7 100644 --- a/display/d.legend.vect/draw.c +++ b/display/d.legend.vect/draw.c @@ -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);