if (cb->serv == NULL) { free (cb); syslog (LOG_ERR, "NIS+: out of memory allocating callback"); return NULL; }
if (__builtin_expect (cb->serv == NULL, 0)) goto free_cb;
__nis_create_callback (int (*callback) (const_nis_name, const nis_object *,					const void *),		       const void *userdata, unsigned int flags){  struct nis_cb *cb;  int sock = RPC_ANYSOCK;  struct sockaddr_in sin;  int len = sizeof (struct sockaddr_in);  char addr[NIS_MAXNAMELEN + 1];  unsigned short port;  cb = (struct nis_cb *) calloc (1, sizeof (struct nis_cb));  if (cb == NULL)    {      syslog (LOG_ERR, "NIS+: out of memory allocating callback");      return NULL;    }  cb->serv = (nis_server *) calloc (1, sizeof (nis_server));  if (cb->serv == NULL)    {      free (cb);      syslog (LOG_ERR, "NIS+: out of memory allocating callback");      return NULL;    }  cb->serv->name = strdup (nis_local_principal ());  cb->serv->ep.ep_val = (endpoint *) calloc (2, sizeof (endpoint));  cb->serv->ep.ep_len = 1;  cb->serv->ep.ep_val[0].family = strdup ("inet");  cb->callback = callback;  cb->userdata = userdata;  if ((flags & NO_AUTHINFO) || !key_secretkey_is_set ())    {      cb->serv->key_type = NIS_PK_NONE;      cb->serv->pkey.n_bytes = NULL;      cb->serv->pkey.n_len = 0;    }  else    {#if 0      if ((cb->serv->pkey.n_bytes = __nis_getpkey (cb->serv->name)) == NULL)	{	  cb->serv->pkey.n_len = 0;	  cb->serv->key_type = NIS_PK_NONE;	}      else	{	  cb->serv->key_type = NIS_PK_DH;	  cb->serv->pkey.n_len = strlen(cb->serv->pkey.n_bytes);	}#else      cb->serv->pkey.n_len =0;      cb->serv->pkey.n_bytes = NULL;      cb->serv->key_type = NIS_PK_NONE;#endif    }  if (flags & USE_DGRAM)    {      cb->serv->ep.ep_val[0].proto = strdup ("udp");      cb->xprt = svcudp_bufcreate (sock, 100, 8192);    }  else    {      cb->serv->ep.ep_val[0].proto = strdup ("tcp");      cb->xprt = svctcp_create (sock, 100, 8192);    }  cb->sock = cb->xprt->xp_sock;  if (!svc_register (cb->xprt, CB_PROG, CB_VERS, cb_prog_1, 0))    {      xprt_unregister (cb->xprt);      svc_destroy (cb->xprt);      xdr_free ((xdrproc_t) _xdr_nis_server, (char *) cb->serv);      free (cb->serv);      free (cb);      syslog (LOG_ERR, "NIS+: failed to register callback dispatcher");      return NULL;    }  if (getsockname (cb->sock, (struct sockaddr *) &sin, &len) == -1)    {      xprt_unregister (cb->xprt);      svc_destroy (cb->xprt);      xdr_free ((xdrproc_t) _xdr_nis_server, (char *) cb->serv);      free (cb->serv);      free (cb);      syslog (LOG_ERR, "NIS+: failed to read local socket info");      return NULL;    }  port = ntohs (sin.sin_port);  get_myaddress (&sin);  snprintf (addr, sizeof (addr), "%s.%d.%d", inet_ntoa (sin.sin_addr),	    (port & 0xFF00) >> 8, port & 0x00FF);  cb->serv->ep.ep_val[0].uaddr = strdup (addr);  return cb;}