SonarQube cloud identified a maintainability issue based on MISRA C
guidelines that prohibit backward jumps. While not a mandatory fix, it
helps to clean up the codebase and improves readability.
Ref. MISRA C:2012, 15.2 - The goto statement shall jump to a label
declared later in the same function.
Configuring the build with CFLAGS="-O2 -g -fanalyzer", we ran into some
build errors, which we address in this commit.
First off, GCC identified a false positive file descriptor leak in
x52d_client.c, this instance is suppressed to avoid breaking the build.
There was a bug in x52d_clock.c, where if the original timezone could
not have a copy due to malloc failure, it would fail when resetting the
TZ environment. This is fixed by ensuring the copy is valid.
Finally, there was a potential NULL pointer dereference if the pinelog
module messes up the log levels, and the lmap_get_string method ends up
returning a NULL which was passed to the DATA macro. This is fixed by
checking for NULL and handling it in case of failure.