summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorremoitnane <remoit(DOT)nane(AT)gmail(DOT)com>2010-07-23 12:16:14 -0700
committerChuck Miller <shadowmil@gmail.com>2010-07-23 22:36:41 -0400
commit1292f043398ec4aeae06da4d3652c94ac7708277 (patch)
tree63a7334baf434fff82e9e8778eafbdf67daa4c78 /src/map/clif.c
parent9e28e286682dc0c958de4db57483483a460e93de (diff)
downloadtmwa-1292f043398ec4aeae06da4d3652c94ac7708277.tar.gz
tmwa-1292f043398ec4aeae06da4d3652c94ac7708277.tar.bz2
tmwa-1292f043398ec4aeae06da4d3652c94ac7708277.tar.xz
tmwa-1292f043398ec4aeae06da4d3652c94ac7708277.zip
Clean up some memory handling
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 62273c0..c27bddf 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -7165,15 +7165,10 @@ void clif_parse_GlobalMessage (int fd, struct map_session_data *sd)
int clif_message (struct block_list *bl, char *msg)
{
unsigned short msg_len = strlen (msg) + 1;
- static int buf_len = -1;
- static unsigned char *buf = NULL;
+ unsigned char buf[512];
- if (buf_len < msg_len)
- {
- if (buf)
- free (buf);
- buf = malloc (buf_len = (msg_len + 16));
- }
+ if (msg_len + 16 > 512)
+ return 0;
nullpo_retr (0, bl);