A few more API error checks
A few more API error checks

Had this lying around on a branch, might as well commit it.

Signed-off-by: Kévin Petit <7be082ac62c87f3fb90b426eef925ff08291362b@free.fr>

kpet/clvk,kpet/clvk,kpet/clvk,kpet/clvk