/*
* Allocate the new request data structure
*/
- if ((packet = malloc(sizeof(*packet))) == NULL) {
+ packet = rad_alloc(NULL, 0);
+ if (!packet) {
fr_strerror_printf("out of memory");
return NULL;
}
- memset(packet, 0, sizeof(*packet));
length = vqp_recvfrom(sockfd, &packet->data, 0,
&packet->src_ipaddr, &packet->src_port,
if (length < 0) {
fr_strerror_printf("Error receiving packet: %s", strerror(errno));
/* packet->data is NULL */
- free(packet);
+ rad_free(&packet);
return NULL;
}
packet->data_len = length; /* unsigned vs signed */