Re: HEdit Crashing Bug

From: ;P (siv@CYBERENET.NET)
Date: 02/25/98


i just looked at free_help, and noticed something else..i think it should
look like this:

void free_help(struct help_index_element *help)
{
  if (help->keyword)
    free(help->keyword);
  if (help->entry && help->duplicate == 0)
    free(help->entry);
  memset(help, 0, sizeof(struct help_index_element));
}

does this make sense? only free it if it is the original entry? a help
topic with multiple keywords shares a pointer to the same entry, so we
should only free it if it's the first..

> This is because it runs through, takes the duplicate entry, frees its
> entry, but then frees the (alphabetically first) keyword's entry, which
> is the same pointer.

i think that a better solution would be to walk back in the help_table to
the first shared entry (they should all be next to eachother), the one
that isn't marked duplicate, and free and replace that one..then walk down
all the duplicates and assign them to the new pointer..i think that if you
don't replace the old pointer with a new one for all of the entries, then
you have a chance of either crashing, or getting duplicate or old entries
written to your help file..

i'll put this on my todo list to look into more..but..no promises..i'm
ill..blargh..=|

siv


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



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