applicom: dereferencing NULL on error path