Set authkey to NULL and check malloc return value.