2003-04-23 Ulrich Drepper <drepper@redhat.com>
+ * nis/ypclnt.c (__yp_bind): Expect ypdb parameter to always we !=
+ NULL. Remove code made redundant by this assumption.
+ (__yp_unbind): Add call to free. Adjust all callers.
+
* nis/ypclnt.c (yp_all): Free the dom_binding object after
unwinding it.
if (domain == NULL || domain[0] == '\0')
return YPERR_BADARGS;
- if (ypdb != NULL)
+ ysd = *ypdb;
+ while (ysd != NULL)
{
- ysd = *ypdb;
- while (ysd != NULL)
- {
- if (strcmp (domain, ysd->dom_domain) == 0)
- break;
- ysd = ysd->dom_pnext;
- }
+ if (strcmp (domain, ysd->dom_domain) == 0)
+ break;
+ ysd = ysd->dom_pnext;
}
if (ysd == NULL)
if (is_new)
{
- if (ypdb != NULL)
- {
- ysd->dom_pnext = *ypdb;
- *ypdb = ysd;
- }
- else
- free (ysd);
+ ysd->dom_pnext = *ypdb;
+ *ypdb = ysd;
}
return YPERR_SUCCESS;
{
clnt_destroy (ydb->dom_client);
ydb->dom_client = NULL;
+ free (ydb);
}
int
else
ydbptr2 = ydbptr->dom_pnext;
__yp_unbind (work);
- free (work);
break;
}
ydbptr2 = ydbptr;
use_ypbindlist = FALSE;
}
else
- {
- __yp_unbind (ydb);
- free (ydb);
- }
+ __yp_unbind (ydb);
ydb = NULL;
status = YPERR_RPC;
}
else
if (ydb != NULL)
- {
- __yp_unbind (ydb);
- free (ydb);
- ydb = NULL;
- }
+ __yp_unbind (ydb);
__set_errno (saved_errno);
/* We don't need the UDP connection anymore. */
__yp_unbind (ydb);
- free (ydb);
ydb = NULL;
clnt = clnttcp_create (&clnt_sin, YPPROG, YPVERS, &clnt_sock, 0, 0);