From 7546a3bbc67caa04a4db76c89e6c99a384798d49 Mon Sep 17 00:00:00 2001 From: patthoyts Date: Tue, 20 Jun 2006 13:12:18 +0000 Subject: [PATCH] Stick to ckalloc/ckfree --- ChangeLog | 1 + generic/udp_tcl.c | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index a7023d2..3e59139 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2006-06-20 Pat Thoyts + * generic/udp_tcl.c: Stick to ckalloc/ckfree. * tests/udp-srv.test: Added new test file which runs a child proces as a udp server. * tests/all.tcl: Support 8.2 and 8.3 test package. diff --git a/generic/udp_tcl.c b/generic/udp_tcl.c index fdeae4a..86b315a 100644 --- a/generic/udp_tcl.c +++ b/generic/udp_tcl.c @@ -580,11 +580,12 @@ UDP_CheckProc(ClientData data, int flags) #endif memset(&recvaddr, 0, socksize); - message = (char *)calloc(1, MAXBUFFERSIZE); + message = (char *)ckalloc(MAXBUFFERSIZE); if (message == NULL) { - UDPTRACE("calloc error\n"); + UDPTRACE("ckalloc error\n"); exit(1); } + memset(message, 0, MAXBUFFERSIZE); actual_size = recvfrom(statePtr->sock, message, buffer_size, 0, (struct sockaddr *)&recvaddr, &socksize); @@ -594,7 +595,7 @@ UDP_CheckProc(ClientData data, int flags) UDPTRACE("UDP error - recvfrom %d\n", statePtr->sock); ckfree(message); } else { - p = (PacketList *)calloc(1, sizeof(struct PacketList)); + p = (PacketList *)ckalloc(sizeof(struct PacketList)); p->message = message; p->actual_size = actual_size; #ifdef SIPC_IPV6 @@ -1064,13 +1065,13 @@ udpInput(ClientData instanceData, char *buf, int bufSize, int *errorCode) return 0; } memcpy(buf, packets->message, packets->actual_size); - free((char *) packets->message); + ckfree((char *) packets->message); UDPTRACE("udp_recv message\n%s", buf); bufSize = packets->actual_size; strcpy(statePtr->peerhost, packets->r_host); statePtr->peerport = packets->r_port; statePtr->packets = packets->next; - free((char *) packets); + ckfree((char *) packets); bytesRead = bufSize; #else /* ! WIN32 */ socksize = sizeof(recvaddr); -- 2.23.0