Re: hmm...

From: Doppleganger Software (doppsoft@TZC.COM)
Date: 01/23/98


>Minor oversight, change the code below PLR_DELETED to look like this:
>
>          /* We get false positive from the original deleted name. */
>          free_char(d->character);
>          CREATE(d->character, struct char_data, 1);
>          /* Check for multiple creations... */
>
>Basically moving the free_char() and CREATE() lines up.  Prevents a minor
>memory leak with the old character's strings if the person puts in an
>invalid name when overwriting a deleted character.  Rare, but still
>leaking.  I've confirmed it still works when overwriting a deleted person.

Ok, question for you on this....what about these 2 lines?

          free(GET_NAME(d->character));
          GET_NAME(d->character) = NULL;

Are they moved or removed?

This is what I had when I moved the 2 lines above as said....

        if (PLR_FLAGGED(d->character, PLR_DELETED)) {
          /* We get false positive from the original deleted name. */
          free_char(d->character);
          CREATE(d->character, struct char_data, 1);
          free(REAL_NAME(d->character));
          REAL_NAME(d->character) = NULL;
          /* Check for multiple creations... */
          if (!Valid_Name(tmp_name)) {
            SEND_TO_Q("Invalid name, please try another.\r\nName: ", d);
            return;
          }
          clear_char(d->character);
          CREATE(d->character->player_specials, struct
player_special_data, 1);


     +------------------------------------------------------------+
     | 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