From db4fd250723ad6121059a71f1cac0e87eb91e695 Mon Sep 17 00:00:00 2001 From: Aaron Marks Date: Thu, 23 Dec 2004 09:49:56 +0000 Subject: Fixed up iptostring() memory leak. --- src/net/network.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/net/network.cpp b/src/net/network.cpp index 0cb41750..b030d92d 100644 --- a/src/net/network.cpp +++ b/src/net/network.cpp @@ -49,12 +49,12 @@ void WFIFOSET(int len) { /** Convert an address from int format to string */ char *iptostring(int address) { short temp1, temp2; + static char asciiIP[16]; - char *temp = (char *)malloc(sizeof(char[20])); temp1 = LOWORD(address); temp2 = HIWORD(address); - sprintf(temp, "%i.%i.%i.%i", LOBYTE(temp1), HIBYTE(temp1), LOBYTE(temp2), HIBYTE(temp2)); - return temp; + sprintf(asciiIP, "%i.%i.%i.%i", LOBYTE(temp1), HIBYTE(temp1), LOBYTE(temp2), HIBYTE(temp2)); + return asciiIP; } /** Open a session with a server */ -- cgit v1.2.3-70-g09d2