On Mon, 29 Jun 1998, John Evans wrote: >The reason that you free the descriptions (if they exist) before >str_dup'ing them is because str_dup allocates more memory. It's not too >bad, but it's a memory leak and those can cause some strange things in >strange places.... The reason that you free the descriptions is so that the MUD crashes as soon as it realizes you just free()'d the prototypes... The offending line in read_object(): *obj = obj_proto[i]; So make sure to str_dup() the strings and _not_ free them. >The reason that one section causes the crash is that the obj is extracted >from the game when you quit or recite and that extraction free's the >memory allocated to the object and since the description is there, but not >CREATE'd, the free call crashes the MUD. The problem is that you cannot free a static string. Thus: char *x = "String"; // crash on 'free(x);' char *x = str_dup("string"); // correct -- George Greer, greerga@circlemud.org | Genius may have its limitations, but http://patches.van.ml.org/ | stupidity is not thus handicapped. http://www.van.ml.org/CircleMUD/ | -- Elbert Hubbard +------------------------------------------------------------+ | 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