Re: HELP! Buildwalk in BPL21

From: George Greer (greerga@circlemud.org)
Date: 11/16/02


On Fri, 15 Nov 2002, Kevin  Dethlefs wrote:

>#0  0x4007a66d in __libc_free (mem=0x80d210d) at malloc.c:2866
>#1  0x8080858 in buildwalk (ch=0x8188320, dir=0) at genwld.c:554
>
>I can't see the problem, earlier I had problems getting it to set the room
>name and desc, and now its trying to get out of the memory. Pls help me in
>anyway you can.

While I can't say what your problem is, the code could use some cleaning:

+      /* Set up data for add_room function */
+      CREATE(room, struct room_data, 1);
+      room->name = str_dup("New BuildWalk Room");
+      sprintf(buf, "This unfinished room was created by %s.\r\n", GET_NAME(ch));
+      room->description = str_dup(buf);
+      room->number = vnum;
+      room->zone = world[ch->in_room].zone;

to:

        struct room_data tmp_room;
        room.name = "New BuildWalk Room";
        sprintf(buf, "This unfinished room was created by %s.\r\n", GET_NAME(ch));
        room->description = str_dup(buf);
        [...]
        add_room(&room);
        [...]
        free(room->description);

Your actual problem is likely random corruption of malloc's tracking data.
Try ElectricFence in Underflow and Overflow modes.

--
George Greer
greerga@circlemud.org

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT