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]
This commit is contained in:
Darryl L. Miles 2024-10-04 19:57:57 +01:00 committed by Tim Edwards
parent 60e78f4ab4
commit 1bb6a7f6c5
1 changed files with 3 additions and 1 deletions

View File

@ -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;
}