Re: freeing memory

From: Mike Breuer (mbreuer@new.rr.com)
Date: 04/13/01


----- Original Message -----
From: "Kras Kresh" <kras_kresh@HOTMAIL.COM>
Sent: Friday, April 13, 2001 6:11 PM


> Do you think I can just check if the string is the prototyped first?
>
> if (obj->description &&
>     obj->description != obj_proto[GET_OBJ_RNUM(obj)].description)
>   free(obj->description);
> obj->description = str_dup("A dagger lies here.");

That code should work fine, although the first condition of your if is not
necessary.  You probably also want to add a version of this test to
extract_obj() in handler.c.

Mike

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/05/01 PST