From: Felix Morgner Date: Thu, 5 Feb 2015 09:53:34 +0000 (+0100) Subject: fix memory leak X-Git-Url: http://git.code-monkey.de/?p=umurmur.git;a=commitdiff_plain;h=ab8b3f6c210906562d01ec63340e8eed985399e9 fix memory leak --- diff --git a/src/sharedmemory.c b/src/sharedmemory.c index f043f08..d6a6a0a 100644 --- a/src/sharedmemory.c +++ b/src/sharedmemory.c @@ -67,8 +67,10 @@ void Sharedmemory_update(void) { channel_t *channel = client_itr->channel; + char* clientAddressString = Util_clientAddressToString( client_itr ); + strncpy( shmptr->client[cc].username, client_itr->username, 120 ); - strncpy( shmptr->client[cc].ipaddress, Util_clientAddressToString( client_itr ), INET6_ADDRSTRLEN - 1 ); + strncpy( shmptr->client[cc].ipaddress, clientAddressString, INET6_ADDRSTRLEN - 1 ); strncpy( shmptr->client[cc].channel, channel->name, 120 ); strncpy( shmptr->client[cc].os, client_itr->os, 120 ); @@ -103,6 +105,7 @@ void Sharedmemory_update(void) shmptr->client[cc].UDPPackets = client_itr->UDPPackets; shmptr->client[cc].TCPPackets = client_itr->TCPPackets; + free(clientAddressString); } cc++; }