From 6bb6f6d3b739f84d85a593bf93cd290399f353f3 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 21 Dec 1997 21:14:57 +0000 Subject: [PATCH] (do_ypcall): Don't free dom_binding twice. --- nis/ypclnt.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/nis/ypclnt.c b/nis/ypclnt.c index 6429c0bb15c..b5351c5b96c 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; } -- 2.47.2