summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-12-21 21:14:57 +0000
committerUlrich Drepper <drepper@redhat.com>1997-12-21 21:14:57 +0000
commit6bb6f6d3b739f84d85a593bf93cd290399f353f3 (patch)
tree6795153dcb60a892d4e0b5608230768ef05a22e4
parent5b627ca39d48d228bf168033919c87a7ca039939 (diff)
(do_ypcall): Don't free dom_binding twice.
-rw-r--r--nis/ypclnt.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index 6429c0bb15..b5351c5b96 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -77,11 +77,12 @@ __yp_bind (const char *domain, dom_binding **ypdb)
if (ysd == NULL)
{
is_new = 1;
- ysd = (dom_binding *) malloc (sizeof *ysd);
- memset (ysd, '\0', sizeof *ysd);
+ ysd = (dom_binding *) calloc (1, sizeof *ysd);
ysd->dom_socket = -1;
ysd->dom_vers = -1;
}
+ else
+ ysd->dom_client = NULL;
try = 0;
@@ -260,11 +261,12 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs,
use_ypbindlist = FALSE;
}
else
- {
- __yp_unbind (ydb);
- free (ydb);
- ydb = NULL;
- }
+ if (ydb != NULL)
+ {
+ __yp_unbind (ydb);
+ free (ydb);
+ ydb = NULL;
+ }
return result;
}