memory bug corrected
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user