Re: [Code] Help bug

From: Martijn Schoemaker (martijn@osp.nl)
Date: 11/29/01


John wrote:

>  if (world[room].func)  /* hope specials do not apply to other rooms */
>   free(world[room].func);

My concern is this piece here. Unless you have modified how special
procedures work in your MUD (i.e. you have dynamically allocated
functions (?)) this will probably disrupt malloc() (and free() with it)
since you are trying to free a piece of code (function) here.

The special procedures are functions and 'func' is only a pointer to
that function or NULL. Since functions cannot be freed, this attempt
is futile and there is no telling what may happen to internal memory
housekeeping.

My vote, just forget about func and do NOT free that pointer. To have
a clear concience you might wanna initialize it to NULL, but no
more that that ;)

Greetings,
Aragorn

Try: imagica.net 4000

--
------ WARNING: This signature contains a VIRUS ! -------
- SHLRUIOHUIOWHLNNMSKHKDLWINDOWSJHFHKJLLUIHEKJLNDHKKJHL -
---------------------------------------------------------

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST