Re: MEDit Free Revisited.

From: Mike Lindsey (mike.lindsey@BPMI.NET)
Date: 07/14/97


Where can you find the update files for Visual C++ 4.2 for 95?


> > I have been recently having problems with crashes in MEdit, on the
> > medit_save_to_disk() function, near free(mob_index) and
free(mob_proto).
> >
> > I remember reading the solution to this is to comment those two lines
> > out... however, that would cause a memory leak, would it not?
> >
> > I searched the archives, no luck.
> >
>         Yes. This is more recently possibly fixd...
> the relevant bits broken up into parts, as i've paraphrased them.
>                 No particular order.
>         --------
>
>         The error in free() is because the mob_index includes the newly
> created mob, which happens to be allocated, but not yet filled in, thus,
> you free a null pointer. Either don't allocate this new mob_index entry
> (espcially since you're just going to free it), or fill in all the data.
>
>         ---------
>         I have upgraded my libc to the most recent release (i forget
which
> it was) and all errors in my medit and sedit functions went away. They
now
> work perfectly.
>         ---------
>         I have been able to remove the crashing error in medit by simply
> removing the line "free(mob_index)". This does create a memory leak i
> think?
>         ---------
>         Removing the free() line in medit does cause a memory leak. The
> effects of this are not immediately noticable, and may be the cause of
> many random non-repeatable errors in otherwise working functions.
>         ---------
>
>         And my personal take on this..
>
>         Go ahead and free it. If you're smart, you've probably got a
> builders port - which is probably also your coding port. This memory leak
> can be contained to this port - its the only place where medit is being
> used alot... it won't affect players. The other will assumedly be
rebooted
> on a frequent basis - thus the leak will not usually affect anything.
>
>                 Of course, this coding style may be practical, but i
think
> we can all agree its like... crappy coding.
>


      +-----------------------------------------------------------+
      | Ensure that you have read the CircleMUD Mailing List FAQ: |
      |   http://cspo.queensu.ca/~fletcher/Circle/list-faq.html   |
      +-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST