Util coverity

Let's fix almost all of the coverity issues in libr/util