Преглед на файлове

* Hotfix: Freeing of freed pointer when replacing script functions. [Lance]

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9634 54d463be-8e91-2dee-dedb-b68131a5f0ec
Lance преди 18 години
родител
ревизия
6827bc726b
променени са 2 файла, в които са добавени 3 реда и са изтрити 1 реда
  1. 2 1
      src/map/npc.c
  2. 1 0
      src/map/script.h

+ 2 - 1
src/map/npc.c

@@ -2178,7 +2178,8 @@ static int npc_parse_function (char *w1, char *w2, char *w3, char *w4, char *fir
 	if(oldscript != NULL) {
 		printf("\r"); //Carriage return to clear the 'loading..' line. [Skotlex]
 		ShowInfo("parse_function: Overwriting user function [%s] (%s:%d)\n", p, file, *lines);
-		script_free_code(oldscript);
+		script_free_vars( &oldscript->script_vars );
+		aFree( oldscript->script_buf );
 		user_db->remove(user_db,str2key(p));
 		strdb_put(user_db, p, script);
 	} else

+ 1 - 0
src/map/script.h

@@ -77,6 +77,7 @@ void script_stop_sleeptimers(int id);
 struct linkdb_node* script_erase_sleepdb(struct linkdb_node *n);
 void script_free_stack(struct script_stack*); 
 void script_free_code(struct script_code* code);
+void script_free_vars(struct linkdb_node **node);
 
 struct dbt* script_get_label_db(void);
 struct dbt* script_get_userfunc_db(void);