[rdkb][common][hal][Fix some bugs warning by coverity]

[Description]
Fix some bugs warning by coverity.
1. Fix TOCTOU(Time of check, time of use).
2. Add initializaion of struct and string.
3. Fix printf arguments.
4. Fix deadcode for if clausure.
5. Fix BAD_COMPARE.
6. Fix ALLOC_FREE_MISMATCH.
7. Fix DIVIDE_BY_ZERO by adding check.

[Release-log]
N/A

Change-Id: I8105287c7e586efe396400e85621c76ba08966e2
2 files changed
tree: 3de29ad524dab7e59d9e101c90a627db174c81d8
  1. src/