From edb2b139f6de5e5a6c002c5977a5d9fa863ddba6 Mon Sep 17 00:00:00 2001 From: John Kohl Date: Tue, 14 Jul 1987 12:47:46 +0000 Subject: plug some memory leaks --- server/client.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'server/client.c') diff --git a/server/client.c b/server/client.c index 03e073c..2ccd635 100644 --- a/server/client.c +++ b/server/client.c @@ -59,10 +59,6 @@ ZServerDesc_t *server; register ZHostList_t *hlp2; register ZClientList_t *clist; - /* allocate a client struct */ - if (!(*client = (ZClient_t *) xmalloc(sizeof(ZClient_t)))) - return(ENOMEM); - /* chain the client's host onto this server's host list */ if (!hlp) { /* bad host list */ @@ -70,18 +66,22 @@ ZServerDesc_t *server; abort(); } - if (!(hlp2 = hostm_find_host(&who->sin_addr))) + if (!(hlp2 = hostm_find_host(&who->sin_addr))) { /* not here */ return(ZSRV_HNOTFOUND); + } /* hlp2 is now pointing to the client's host's address struct */ if (!hlp2->zh_clients) { - xfree(*client); return(EINVAL); } - if (!(clist = (ZClientList_t *)xmalloc(sizeof(ZClientList_t)))) { + /* allocate a client struct */ + if (!(*client = (ZClient_t *) xmalloc(sizeof(ZClient_t)))) + return(ENOMEM); + + if (!(clist = (ZClientList_t *) xmalloc(sizeof(ZClientList_t)))) { xfree(*client); return(ENOMEM); } -- cgit v1.2.3