Fix use-after-free complained by coverity

It's not really use-after-use, because the pointer is not dereferenced
Fix coverity annotations
Merge branch 'atronix' into coverity_scan