Fix some small type issues in printf formats
Fix 2 unlikely memory leaks
Fasten utils_tidy_path() a little and fix possible leaks in it

Fix possible leaks with bad paths, and also speed up some part of the
function by avoiding unnecessary allocations and string length
computations.
Always use proper functions argument lists
Don't depend on an implementation detail of S_ISREG and S_ISDIR
Use proper argument list
Merge remote-tracking branch 'upstream/master'