MCPcopy Create free account
hub / github.com/HyperDbg/HyperDbg / NewTokenList

Function NewTokenList

hyperdbg/script-engine/code/common.c:363–393  ·  view source on GitHub ↗

* @brief Allocates a new SCRIPT_ENGINE_TOKEN_LIST * * @return PSCRIPT_ENGINE_TOKEN_LIST the allocated token list */

Source from the content-addressed store, hash-verified

361 * @return PSCRIPT_ENGINE_TOKEN_LIST the allocated token list
362 */
363PSCRIPT_ENGINE_TOKEN_LIST
364NewTokenList(void)
365{
366 PSCRIPT_ENGINE_TOKEN_LIST TokenList = NULL;
367
368 //
369 // Allocation of memory for SCRIPT_ENGINE_TOKEN_LIST structure
370 //
371 TokenList = (PSCRIPT_ENGINE_TOKEN_LIST)malloc(sizeof(*TokenList));
372
373 if (TokenList == NULL)
374 {
375 //
376 // There was an error allocating buffer
377 //
378 return NULL;
379 }
380
381 //
382 // Initialize fields of SCRIPT_ENGINE_TOKEN_LIST
383 //
384 TokenList->Pointer = 0;
385 TokenList->Size = TOKEN_LIST_INIT_SIZE;
386
387 //
388 // Allocation of memory for SCRIPT_ENGINE_TOKEN_LIST buffer
389 //
390 TokenList->Head = (PSCRIPT_ENGINE_TOKEN *)malloc(TokenList->Size * sizeof(PSCRIPT_ENGINE_TOKEN));
391
392 return TokenList;
393}
394
395/**
396 * @brief Removes allocated memory of a SCRIPT_ENGINE_TOKEN_LIST

Callers 3

ScriptEngineParseFunction · 0.85
CodeGenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected