New to the tbaMUD forum's, but a long time follower. I started playing with a copy of Gicker's d20 mud base and converting it to a Pathfinder mud. Anyways, I've got a very obvious memory leak in it and I'm not familiar enough with Circle/TBA to know what I'm looking for. Anyway, something is CREATE'd, but I know of no way to free the memory it's using, so it's creating a leak. Is there a way to free memory once it's been CREATE'd?
Any help would be appreciated.
Code:
void postmaster_send_mail(struct char_data *ch, struct char_data *mailman, int cmd, char *arg)
{
long recipient;
char buf[MAX_INPUT_LENGTH]={'\0'}, **mailwrite;
one_argument(arg, buf);
if (!*buf)
{ /* you'll get no argument from me! */
act("You need to specify an addressee!",
FALSE, mailman, 0, ch, TO_VICT);
return;
}
CREATE(mailwrite, char *, 1);
if (!strcmp(buf, "all") && GET_ADMLEVEL(ch) == ADMLVL_IMPL)
{
act("$n starts to write some mail.", TRUE, ch, 0, 0, TO_ROOM);
SET_BIT_AR(PLR_FLAGS(ch), PLR_MAILING); /* string_write() sets writing. */
/* Start writing! */
RECREATE(mailwrite, char *, 1);
string_write(ch->desc, mailwrite, MAX_MAIL_SIZE, -999, NULL);
}
else if (!strcmp(buf, "staff") && GET_ADMLEVEL(ch) > 0)
{
act("$n starts to write some mail.", TRUE, ch, 0, 0, TO_ROOM);
SET_BIT_AR(PLR_FLAGS(ch), PLR_MAILING); /* string_write() sets writing. */
/* Start writing! */
RECREATE(mailwrite, char *, 1);
string_write(ch->desc, mailwrite, MAX_MAIL_SIZE, -899, NULL);
}
else
{
if ((recipient = get_id_by_name(buf)) < 0 || !mail_recip_ok(buf))
{
act("No one by that name is registered here!", FALSE, mailman, 0, ch, TO_VICT);
return; /* MEMORY LEAK HERE */
}
act("$n starts to write some mail.", TRUE, ch, 0, 0, TO_ROOM);
SET_BIT_AR(PLR_FLAGS(ch), PLR_MAILING); /* string_write() sets writing. */
/* Start writing! */
RECREATE(mailwrite, char *, 1);
string_write(ch->desc, mailwrite, MAX_MAIL_SIZE, recipient, NULL);
}
}