memory bug corrected

This commit is contained in:
cvs
2000-04-07 14:24:01 +00:00
parent 9c9a2d45a5
commit c70f0b7cb8
12 changed files with 45 additions and 25 deletions

View File

@@ -36,7 +36,7 @@ int CocInitServer(int bufsize, int port) {
if (bufsize==0) bufsize=1024;
ERR_P(buf=str_create_buf(bufsize, '\0'));
ERR_P(bufo=str_create_buf(bufsize,'\0'));
cList=malloc(sizeof(*cList)); /* empty header */
NEW(cList); /* empty header */
/* first try to connect to an existing server */
@@ -81,7 +81,7 @@ int CocHandle1Request(int tmo_msec, int fd) {
cl->mode=0;
cl->cmd[0]='\0';
cl->res[0]='\0';
cList=malloc(sizeof(*cList));
NEW(cList);
cList->next=cl;
h=gethostbyaddr(&cadr.sin_addr, 4, AF_INET);
if (h==NULL) {
@@ -99,7 +99,7 @@ int CocHandle1Request(int tmo_msec, int fd) {
close(cl->fd);
FD_CLR(cl->fd, &mask);
cl0->next=cl->next;
free(cl);
my_free(cl);
cl=cl0;
} else {
@@ -233,9 +233,9 @@ void CocCloseServer() {
close(cl->fd);
cl0=cl;
cl=cl->next;
free(cl0);
my_free(cl0);
}
free(cList);
my_free(cList);
close(mainFd);
str_free_buf(buf); str_free_buf(bufo);
logfileClose();