Commit 857f5de3 authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Fix memory leak.

parent 5cc72c25
......@@ -216,7 +216,10 @@ int PrrtSocket_close(PrrtSocket *sock_ptr) {
if (sock_ptr->receivers != NULL) {
while (List_count(sock_ptr->receivers) > 0) {
free(List_shift(sock_ptr->receivers));
// TODO: properly destroy receiver object
PrrtReceiver *recv = List_shift(sock_ptr->receivers);
free((void *) recv->host_name);
free(recv);
}
List_destroy(sock_ptr->receivers);
sock_ptr->receivers = NULL;
......@@ -270,7 +273,7 @@ PrrtPacket *PrrtSocket_recv_feedback(const PrrtSocket *sock_ptr, void *bufin, co
uint16_t remote_port = ntohs(remote.sin_port);
char *remote_host = inet_ntoa(remote.sin_addr);
debug("Received feedback %s:%d", remote_host, remote_port);
//debug("Received feedback %s:%d", remote_host, remote_port);
PrrtPacket *packet_ptr = calloc(1, sizeof(PrrtPacket));
check_mem(packet_ptr);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment