Skip to content

Commit

Permalink
ps.map: initialize variable contents before using them in get_ll_boun…
Browse files Browse the repository at this point in the history
…ds (#4501)

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 authored Oct 14, 2024
1 parent cb7cbab commit ed02be5
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 ed02be5

Please sign in to comment.