More "malloc + strlen + strcpy --> strdup" in module parameter code.

git-svn-id: https://svn.eduke32.com/eduke32@2506 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2012-03-20 19:28:22 +00:00
parent ea9abc58c9
commit 270342463f
2 changed files with 4 additions and 8 deletions

View file

@ -8583,8 +8583,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
if (argc > i+1) if (argc > i+1)
{ {
g_scriptModules = (char **) Brealloc (g_scriptModules, (g_scriptModulesNum+1) * sizeof(char *)); g_scriptModules = (char **) Brealloc (g_scriptModules, (g_scriptModulesNum+1) * sizeof(char *));
g_scriptModules[g_scriptModulesNum] = Bmalloc(Bstrlen((char *)argv[i+1]) + 1); g_scriptModules[g_scriptModulesNum] = Bstrdup(argv[i+1]);
Bstrcpy(g_scriptModules[g_scriptModulesNum], (char *)argv[i+1]);
++g_scriptModulesNum; ++g_scriptModulesNum;
i++; i++;
} }
@ -8596,8 +8595,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
if (argc > i+1) if (argc > i+1)
{ {
g_defModules = (char **) Brealloc (g_defModules, (g_defModulesNum+1) * sizeof(char *)); g_defModules = (char **) Brealloc (g_defModules, (g_defModulesNum+1) * sizeof(char *));
g_defModules[g_defModulesNum] = Bmalloc(Bstrlen((char *)argv[i+1]) + 1); g_defModules[g_defModulesNum] = Bstrdup(argv[i+1]);
Bstrcpy(g_defModules[g_defModulesNum], (char *)argv[i+1]);
++g_defModulesNum; ++g_defModulesNum;
i++; i++;
} }

View file

@ -8826,8 +8826,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
if (argc > i+1) if (argc > i+1)
{ {
g_scriptModules = (char **) Brealloc (g_scriptModules, (g_scriptModulesNum+1) * sizeof(char *)); g_scriptModules = (char **) Brealloc (g_scriptModules, (g_scriptModulesNum+1) * sizeof(char *));
g_scriptModules[g_scriptModulesNum] = Bmalloc(Bstrlen((char *)argv[i+1]) + 1); g_scriptModules[g_scriptModulesNum] = Bstrdup(argv[i+1]);
Bstrcpy(g_scriptModules[g_scriptModulesNum], (char *)argv[i+1]);
++g_scriptModulesNum; ++g_scriptModulesNum;
i++; i++;
} }
@ -8839,8 +8838,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
if (argc > i+1) if (argc > i+1)
{ {
g_defModules = (char **) Brealloc (g_defModules, (g_defModulesNum+1) * sizeof(char *)); g_defModules = (char **) Brealloc (g_defModules, (g_defModulesNum+1) * sizeof(char *));
g_defModules[g_defModulesNum] = Bmalloc(Bstrlen((char *)argv[i+1]) + 1); g_defModules[g_defModulesNum] = Bstrdup(argv[i+1]);
Bstrcpy(g_defModules[g_defModulesNum], (char *)argv[i+1]);
++g_defModulesNum; ++g_defModulesNum;
i++; i++;
} }