[LIBS] Fix various issues in LIBS code.

Coverity scan has detected several problems in Xvisor code.
This series of patches fixes some of the problems related to
the libs code.

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Signed-off-by: Anup Patel <anup@brainfault.org>