Skip to content

Commit

Permalink
dezefix
Browse files Browse the repository at this point in the history
  • Loading branch information
BraXi committed Sep 11, 2024
1 parent 36a9392 commit f94e00d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/tools/tools_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,13 @@ char* Com_Parse(char* data)

void Com_Tokenize(char* text)
{
memset(com_argv, 0, sizeof(char*) * MAX_ARGS);
// clear the args from the last string
for (int i = 0; i < com_argc; i++)
free(com_argc[i]);

//cmd_argc = 0;
com_args[0] = 0;


com_argc = 0;
com_args = NULL;
Expand Down Expand Up @@ -390,7 +396,7 @@ void Com_Tokenize(char* text)

if (com_argc < MAX_ARGS)
{
com_argv[com_argc] = new char[strlen(com_token) + 1];
com_argv[com_argc] = (char*)malloc(strlen(com_token) + 1);
strcpy(com_argv[com_argc], com_token);
com_argc++;
}
Expand Down

0 comments on commit f94e00d

Please sign in to comment.