Update.
* 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.
This commit is contained in:
parent
47ae394214
commit
345d920835
|
@ -1,5 +1,9 @@
|
||||||
2003-04-23 Ulrich Drepper <drepper@redhat.com>
|
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
|
* nis/ypclnt.c (yp_all): Free the dom_binding object after
|
||||||
unwinding it.
|
unwinding it.
|
||||||
|
|
||||||
|
|
36
nis/ypclnt.c
36
nis/ypclnt.c
|
@ -66,15 +66,12 @@ __yp_bind (const char *domain, dom_binding **ypdb)
|
||||||
if (domain == NULL || domain[0] == '\0')
|
if (domain == NULL || domain[0] == '\0')
|
||||||
return YPERR_BADARGS;
|
return YPERR_BADARGS;
|
||||||
|
|
||||||
if (ypdb != NULL)
|
ysd = *ypdb;
|
||||||
|
while (ysd != NULL)
|
||||||
{
|
{
|
||||||
ysd = *ypdb;
|
if (strcmp (domain, ysd->dom_domain) == 0)
|
||||||
while (ysd != NULL)
|
break;
|
||||||
{
|
ysd = ysd->dom_pnext;
|
||||||
if (strcmp (domain, ysd->dom_domain) == 0)
|
|
||||||
break;
|
|
||||||
ysd = ysd->dom_pnext;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ysd == NULL)
|
if (ysd == NULL)
|
||||||
|
@ -207,13 +204,8 @@ __yp_bind (const char *domain, dom_binding **ypdb)
|
||||||
|
|
||||||
if (is_new)
|
if (is_new)
|
||||||
{
|
{
|
||||||
if (ypdb != NULL)
|
ysd->dom_pnext = *ypdb;
|
||||||
{
|
*ypdb = ysd;
|
||||||
ysd->dom_pnext = *ypdb;
|
|
||||||
*ypdb = ysd;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
free (ysd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return YPERR_SUCCESS;
|
return YPERR_SUCCESS;
|
||||||
|
@ -224,6 +216,7 @@ __yp_unbind (dom_binding *ydb)
|
||||||
{
|
{
|
||||||
clnt_destroy (ydb->dom_client);
|
clnt_destroy (ydb->dom_client);
|
||||||
ydb->dom_client = NULL;
|
ydb->dom_client = NULL;
|
||||||
|
free (ydb);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -260,7 +253,6 @@ yp_unbind_locked (const char *indomain)
|
||||||
else
|
else
|
||||||
ydbptr2 = ydbptr->dom_pnext;
|
ydbptr2 = ydbptr->dom_pnext;
|
||||||
__yp_unbind (work);
|
__yp_unbind (work);
|
||||||
free (work);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ydbptr2 = ydbptr;
|
ydbptr2 = ydbptr;
|
||||||
|
@ -340,10 +332,7 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs,
|
||||||
use_ypbindlist = FALSE;
|
use_ypbindlist = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
__yp_unbind (ydb);
|
||||||
__yp_unbind (ydb);
|
|
||||||
free (ydb);
|
|
||||||
}
|
|
||||||
|
|
||||||
ydb = NULL;
|
ydb = NULL;
|
||||||
status = YPERR_RPC;
|
status = YPERR_RPC;
|
||||||
|
@ -360,11 +349,7 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (ydb != NULL)
|
if (ydb != NULL)
|
||||||
{
|
__yp_unbind (ydb);
|
||||||
__yp_unbind (ydb);
|
|
||||||
free (ydb);
|
|
||||||
ydb = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
__set_errno (saved_errno);
|
__set_errno (saved_errno);
|
||||||
|
|
||||||
|
@ -715,7 +700,6 @@ yp_all (const char *indomain, const char *inmap,
|
||||||
|
|
||||||
/* We don't need the UDP connection anymore. */
|
/* We don't need the UDP connection anymore. */
|
||||||
__yp_unbind (ydb);
|
__yp_unbind (ydb);
|
||||||
free (ydb);
|
|
||||||
ydb = NULL;
|
ydb = NULL;
|
||||||
|
|
||||||
clnt = clnttcp_create (&clnt_sin, YPPROG, YPVERS, &clnt_sock, 0, 0);
|
clnt = clnttcp_create (&clnt_sin, YPPROG, YPVERS, &clnt_sock, 0, 0);
|
||||||
|
|
Loading…
Reference in New Issue