[mw-devel] MW3 r1312 - trunk/src

welshbyte at sucs.org welshbyte at sucs.org
Mon Dec 10 01:18:20 GMT 2012


Author: welshbyte
Date: 2012-12-10 01:18:20 +0000 (Mon, 10 Dec 2012)
New Revision: 1312

Modified:
   trunk/src/script_inst.c
Log:
Fix a couple more leaks and revert a "fix" for another leak which is causing a segfault. That leak will still have to be fixed.


Modified: trunk/src/script_inst.c
===================================================================
--- trunk/src/script_inst.c	2012-12-08 17:49:45 UTC (rev 1311)
+++ trunk/src/script_inst.c	2012-12-10 01:18:20 UTC (rev 1312)
@@ -1265,7 +1265,7 @@
 		if (script_debug) escprintf("- set: updating var $%s (%s) to '%s'\n", what, var_str_val(&var), text);
 		VAR_STR_UPDATE(&var, text);
 	} else {
-		VAR_STR_CREATE(&var, strdup(text));
+		VAR_STR_CREATE(&var, text);
 		if (script_debug) escprintf("- set: creating var $%s setting to '%s'\n", what, text);
 	}
 
@@ -1319,7 +1319,7 @@
 		if (script_debug) escprintf("- set: updating var $%s (%s) to '%s'\n", what, var_str_val(&var), value);
 		VAR_STR_UPDATE(&var, value);
 	} else {
-		VAR_STR_CREATE(&var, strdup(value));
+		VAR_STR_CREATE(&var, value);
 		if (script_debug) escprintf("- set: creating var $%s setting to '%s'\n", what, value);
 	}
 	if (value!=NULL) free(value);
@@ -1512,8 +1512,6 @@
 		for (i=2; i<new_argc; ++i)
 			ARG_STR_FORCE(&locals, i-1, args[i]);
 	}
-	for (i = 0; i < pc->argc; i++)
-		if (args[i]) free(args[i]);
 	free(args); /* contained strings are now in the variable list */
 	VAR_STR_FORCE(&locals, "?", "");
 	saved_locals = local_vars;




More information about the mw-devel mailing list