From 1bb6a7f6c538952b92fce424d8e015703e855147 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:57:57 +0100 Subject: [PATCH] plotPNM.c: warning: variable 'strip' is used uninitialized The compiler warning concerns the use of 'goto done;' has cleanup that accesses 'strip' before initialization. While evaluating this I also notice the other 2 variables 'rtile' and 'lkstep' are globals, but their pointers are not invalidated at the time of free. plotPNM.c:821:6: warning: variable 'strip' is used uninitialized whenever 'if' condition is true clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- plot/plotPNM.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plot/plotPNM.c b/plot/plotPNM.c index b382e850..be620121 100644 --- a/plot/plotPNM.c +++ b/plot/plotPNM.c @@ -582,7 +582,7 @@ PlotPNM(fileName, scx, layers, xMask, width) int i, x, y, tile_ydelta; int save_ds, iter; int scale_over_2, ds_over_2; - float *strip; + float *strip = NULL; float scale, invscale, scaledown, normal; #ifdef VERSATEC @@ -937,8 +937,10 @@ PlotPNM(fileName, scx, layers, xMask, width) done: PlotPNMdownsample = save_ds; freeMagic(rtile); + rtile = NULL; freeMagic(strip); freeMagic(lkstep); + lkstep = NULL; return; }