[CODE] DG Script Errors?

From: Justin Adler (spam@WORLD-DOMINATION.COM.AU)
Date: 07/21/02


Hello Guru's.


   I've been having an AWEFUL load of trouble with my (very old) version
of DG Scripts, which i patched into my circle code back in 97 or 98.

   None-the-less, i've just checked the latest version [see thread: Latest
DG script patches. (pl8 :) ] for a fix to my bug, and it still exists i
think.


BUG
^^^
   Each mob and obj (and i think room) has a 'struct script_data *sc' and
a pointer to the prototype.

   Now I do NOT free the prototype (as this is used by others), but i do
free the script_data. To do that, i made my own function, but later found
this has already been done in :-

File: db.script.c
+/* release memory allocated for a script */
+void free_script(struct script_data *sc)
{ ... }

This (above) function eventually calls :-
+void trig_data_free(trig_data *this_data)
{ ... }

... and this is what is crashing me.

The current code has this section --COMMENTED OUT-- ... which is fine, but
results in MEMORY NOT BEING FREE'D (ie. Memory Leaking).

+    /*
+     * The command list is a memory leak right now!
+     *
+    if (cmdlist != trigg->cmdlist || this_data->proto)
+ for (i = cmdlist; i;) {
+     j = i;
+     i = i->next;
+     free(j->cmd);
+     free(j);
+ }
+ */

Even the comment says so ;)

has anyone figured out why FREEING the 'trigg->cmdlist' OR / AND 'trigg-
>curr_state' crashes the game?

I've been in the process of tracking down memory leaks, and DG triggers
has a few.

I hope someone could shed some light here .....

-Pure Krome-

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT