mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Make some more dymatic buffer and correct some free()
svn path=/trunk/; revision=17808
This commit is contained in:
parent
6b218f4e59
commit
3a98addd02
1 changed files with 25 additions and 4 deletions
|
@ -295,7 +295,7 @@ static BOOL RunFile(LPTSTR filename)
|
|||
static VOID
|
||||
Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
|
||||
{
|
||||
TCHAR szFullName[CMDLINE_LENGTH];
|
||||
TCHAR *szFullName=NULL;
|
||||
TCHAR *first = NULL;
|
||||
TCHAR *rest = NULL;
|
||||
TCHAR *full = NULL;
|
||||
|
@ -321,7 +321,7 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
|
|||
rest = malloc ( (_tcslen(Rest) + 512) * sizeof(TCHAR));
|
||||
if (rest == NULL)
|
||||
{
|
||||
free (full);
|
||||
free (first);
|
||||
error_out_of_memory();
|
||||
return ;
|
||||
}
|
||||
|
@ -329,12 +329,22 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
|
|||
full = malloc ( (_tcslen(Full) + 512) * sizeof(TCHAR));
|
||||
if (full == NULL)
|
||||
{
|
||||
free (full);
|
||||
free (first);
|
||||
free (rest);
|
||||
error_out_of_memory();
|
||||
return ;
|
||||
}
|
||||
|
||||
szFullName = malloc ( (_tcslen(Full) + 512) * sizeof(TCHAR));
|
||||
if (full == NULL)
|
||||
{
|
||||
free (first);
|
||||
free (rest);
|
||||
free (full);
|
||||
error_out_of_memory();
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/* Though it was already parsed once, we have a different set of rules
|
||||
for parsing before we pass to CreateProccess */
|
||||
|
@ -398,6 +408,11 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
|
|||
|
||||
if (!working) ConErrResPuts (STRING_FREE_ERROR1);
|
||||
|
||||
free (first);
|
||||
free (rest);
|
||||
free (full);
|
||||
free (szFullName);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -406,6 +421,11 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
|
|||
if (!SearchForExecutable (first, szFullName))
|
||||
{
|
||||
error_bad_command ();
|
||||
|
||||
free (first);
|
||||
free (rest);
|
||||
free (full);
|
||||
free (szFullName);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -495,7 +515,8 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
|
|||
|
||||
free(first);
|
||||
free(rest);
|
||||
free(full);
|
||||
free(full);
|
||||
free (szFullName);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue