mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
609fbeb008
The ```addon_row_height``` variable is conditionally initialized in some branches, which also set ```addon_latch``` to one(true). Later in the loop's body, ```addon_row_height``` is accessed if ```addon_latch``` is true. Unlike ```addon_row_height```, ```addon_latch``` is defined outside of the loop's body, and as it is never reset to zero, keeps it's value of one once it has been assigned. Future iterations of the loop can therefore not branch into the code that initializes ```addon_row_height``` and (re)assigns ```addon_latch```, and ```addon_latch``` will be true, which causes ```addon_row_height``` to be accessed without having been initialized. On most platforms, the ```addon_row_height``` variable will always be allocated on the same memory, while skipping the initialization causes the value that was previously assigned to ```addon_row_height``` to remain on that memory. Pull the variable declaration out of the for loop's body to assure the previous iteration's value remains there independend of compiler or platform specific behaviour.