This function must return 0 on failure

Dicovered by scan-build