summaryrefslogtreecommitdiff
path: root/server/client.c
diff options
context:
space:
mode:
authorGravatar John Kohl <jtkohl@mit.edu>1987-07-14 12:47:46 +0000
committerGravatar John Kohl <jtkohl@mit.edu>1987-07-14 12:47:46 +0000
commitedb2b139f6de5e5a6c002c5977a5d9fa863ddba6 (patch)
tree67ec7187a5416d85e857e7a0638747deef0a70b3 /server/client.c
parent97e6ea0054af278794e154a478cb83df45664275 (diff)
plug some memory leaks
Diffstat (limited to 'server/client.c')
-rw-r--r--server/client.c14
1 files changed, 7 insertions, 7 deletions
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);
}