File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,8 @@ Optional plugins:
7676 # define YSI_DEFAULT_MALLOC (256 )
7777#endif
7878
79+ forward Alloc: Malloc_Allocate (size, const bool: clear = false );
80+
7981/* -------------------------------------------------------------------------*//* *
8082 * <remarks>
8183 * Finds all "BOUNDS 0" OpCodes in the AMX and rewrites them to "NOP NOP". The
@@ -179,7 +181,10 @@ public OnCodeInit()
179181 @emit JUMP addr + offset // Continue with code.
180182 }
181183 while ((idx = AMX_GetPublicEntry (idx, entry)));
182- malloc (YSI_DEFAULT_MALLOC);
184+ // Allocate memory for callback parameters to use. They use some of the heap when passing
185+ // strings etc, so save some space at the bottom of the heap for them to use. This just leaks
186+ // memory from the allocation system, and allows it to be safely clobbered by those calls.
187+ Malloc_Allocate (YSI_DEFAULT_MALLOC);
183188 P: 6 (" Malloc_OnCodeInit done" );
184189 return 1 ;
185190}
You can’t perform that action at this time.
0 commit comments