Skip to content

Commit

Permalink
ps.map: initialize variable contents before using them in get_ll_bounds
Browse files Browse the repository at this point in the history
In some situations, when some conditionals fails, we would be assigning
uninitialized variables to values, which is undefined behavior. Fix that
by assigning a value to the variables.

This was found using cppcheck tool.

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>
  • Loading branch information
ymdatta committed Oct 11, 2024
1 parent cbc3ff4 commit b33bd46
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ps/ps.map/do_geogrid.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ void get_ll_bounds(double *w, double *e, double *s, double *n)
double ew, ns;
int first;

east = west = north = south = 0.0;
e1 = PS.w.east;
w1 = PS.w.west;
n1 = PS.w.north;
Expand Down

0 comments on commit b33bd46

Please sign in to comment.