summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Marks <nymacro@gmail.com>2004-12-23 09:49:56 +0000
committerAaron Marks <nymacro@gmail.com>2004-12-23 09:49:56 +0000
commitdb4fd250723ad6121059a71f1cac0e87eb91e695 (patch)
tree38a8b6f9ced4411aa2d7650f50e8a0cfcf5b19eb
parentde6b321862d4f0329326bdc44934614df5e411ea (diff)
downloadmana-db4fd250723ad6121059a71f1cac0e87eb91e695.tar.gz
mana-db4fd250723ad6121059a71f1cac0e87eb91e695.tar.bz2
mana-db4fd250723ad6121059a71f1cac0e87eb91e695.tar.xz
mana-db4fd250723ad6121059a71f1cac0e87eb91e695.zip
Fixed up iptostring() memory leak.
-rw-r--r--src/net/network.cpp6
1 files 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 */