Re: Medit and Oedit problem in Obuild

From: Sammy (samedi@DHC.NET)
Date: 09/19/97

On Thu, 18 Sep 1997, wrote:

[editor's note:  paragraph breaks added for readability, but I don't have
the time to fix the punctuation :P]
> I'm using the most recent version that I am aware of, v.7 of obuild, but I
> still am getting crashes with medit and oedit, if i edit an object that
> currently exists it usually goes haywire.  After I edit the existing
> object, the one in my inventory is non-accesaable by conventional means, I
> can't get it, drop it, but I can do drop all, or get all, then I purge it
> on the ground, and crash bang boom.  Now I though fix_obj_strings
> restructed pointers to the right place.  But, i don't know, and the core
> just says, malloc failure, sometimes when It free's, sometimes when It
> allocates, I've installed the dmalloc lib and it says its in str_dup,
> sometimes and in handler.c in the free(stringlist) in isname.  Has anyone
> else encounter these problems ?

Yeah something happened between .06 and .07 and the fix stopped working
(or maybe it only worked on an older version of linux).  THere's a fix for
the fix that's been posted a few times and I thought it was on my web page
but apparently not.  See below.

> Another wierd thing is I have a struct
> struct test {
> char *name;
> int i;
> };
> I allocate memory with CREATE for test, then allocate memory as needed for
> name, then I free name, then free test, for some reason it doesn't seem to
> be set to null, so after I free'd test I do a test = NULL, I was wondering
> if this was standard behavior ?

THe ANSI C standard doesn't require free to NULL the pointer, so some
compilers may NULL it, others may leave it alone, allowing you to continue
to read the data in it, while writing to it is probably going to result in
a segfault.  If you want it to be set to NULL after a free, you'll have to
do it yourself.


Date: Wed, 23 Apr 1997 01:28:25 +0100
From: Paul Stewart <>
To: Sammy <>
Subject: Re: bug in obuild

ok, here it is... and it works!  I was still getting occasional crashes
the way I did it before.

In msave, move the fix_mob_strings to after the copy_mob and change to
the following:

void fix_mob_strings(struct char_data * proto, struct char_data *
  struct char_data *i;

  for(i = character_list; i; i = i->next) {
    if(IS_NPC(i) && i->nr == buffer->nr) {
      if(i-> && i-> != buffer->
        i-> = proto->;
      if(i->player.short_descr && i->player.short_descr !=
        i->player.short_descr = proto->player.short_descr;
      if(i->player.long_descr && i->player.long_descr !=
        i->player.long_descr = proto->player.long_descr;
      if(i->player.description && i->player.description !=
        i->player.description = proto->player.description;

I did the exact same to fix_obj_strings.
Paul Stewart

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

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