#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);
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
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);