But, new_note() does:

NOTE_DATA *new_note()

{

   NOTE_DATA *note;

   note = calloc(sizeof(*note), 1);

   return note;

}          

> -----Original Message-----
> From: Bobby Bailey [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, February 08, 2003 10:59 PM
> To: [email protected]
> Subject: Re: Question involving ROM's note system
> 
> 
> On Saturday 08 February 2003 09:43pm, Jeremy Hill wrote:
> > Greetings,
> >
> > For those who still use ROM's note system, I have a 
> question for you.
> > After I make a new_note(), fill the fields, and 
> append_note(pnote), should
> > I then:
> >
> > 1. free_note(pnote)
> > 2. pnote = NULL;
> > 3. Nothing.
> >
> > Personally, I would think #1, but code I have been looking 
> at seems to 
> > favor pnote = NULL.  Seems like this would cause memory to leak.
> >
> > Any suggestions?
> >
> > - Jeremy Hill
> 
> The append_note() function does not allocate new memory for 
> the note.  It 
> simply determines the correct note list and inserts the 
> pointer, then writes 
> the new note to disk. This is why you simply set pnote NULL, 
> since if you 
> free_note()'d it, the pointer in the note list would now 
> point to invalid 
> data.
> 
> -- 
> Bobby Bailey    | "The only source of knowledge is experience."
> MUD Developer   | -- Albert Einstein
> Internet Junkie | PGP Keys: http://chil.kyndig.com/pgp 
> http://www.kyndig.com/ -- Mud & Online Text > Game Community
> 
> 
> 
> -- 
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom
> 

Reply via email to