Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
08c17ada
Commit
08c17ada
authored
Nov 16, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 16, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: Added HeapFree wrapper.
parent
62e77128
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
50 deletions
+55
-50
batch.c
programs/cmd/batch.c
+3
-3
builtins.c
programs/cmd/builtins.c
+19
-19
directory.c
programs/cmd/directory.c
+10
-10
wcmd.h
programs/cmd/wcmd.h
+5
-0
wcmdmain.c
programs/cmd/wcmdmain.c
+18
-18
No files found.
programs/cmd/batch.c
View file @
08c17ada
...
@@ -110,7 +110,7 @@ void WCMD_batch (WCHAR *file, WCHAR *command, BOOL called, WCHAR *startLabel, HA
...
@@ -110,7 +110,7 @@ void WCMD_batch (WCHAR *file, WCHAR *command, BOOL called, WCHAR *startLabel, HA
* to the caller's caller.
* to the caller's caller.
*/
*/
HeapFree
(
GetProcessHeap
(),
0
,
context
->
batchfileW
);
heap_free
(
context
->
batchfileW
);
LocalFree
(
context
);
LocalFree
(
context
);
if
((
prev_context
!=
NULL
)
&&
(
!
called
))
{
if
((
prev_context
!=
NULL
)
&&
(
!
called
))
{
WINE_TRACE
(
"Batch completed, but was not 'called' so skipping outer batch too
\n
"
);
WINE_TRACE
(
"Batch completed, but was not 'called' so skipping outer batch too
\n
"
);
...
@@ -265,7 +265,7 @@ WCHAR *WCMD_fgets(WCHAR *buf, DWORD noChars, HANDLE h)
...
@@ -265,7 +265,7 @@ WCHAR *WCMD_fgets(WCHAR *buf, DWORD noChars, HANDLE h)
status
=
ReadFile
(
h
,
bufA
,
noChars
,
&
charsRead
,
NULL
);
status
=
ReadFile
(
h
,
bufA
,
noChars
,
&
charsRead
,
NULL
);
if
(
!
status
||
charsRead
==
0
)
{
if
(
!
status
||
charsRead
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
bufA
);
heap_free
(
bufA
);
return
NULL
;
return
NULL
;
}
}
...
@@ -280,7 +280,7 @@ WCHAR *WCMD_fgets(WCHAR *buf, DWORD noChars, HANDLE h)
...
@@ -280,7 +280,7 @@ WCHAR *WCMD_fgets(WCHAR *buf, DWORD noChars, HANDLE h)
SetFilePointerEx
(
h
,
filepos
,
NULL
,
FILE_BEGIN
);
SetFilePointerEx
(
h
,
filepos
,
NULL
,
FILE_BEGIN
);
i
=
MultiByteToWideChar
(
cp
,
0
,
bufA
,
p
-
bufA
,
buf
,
noChars
);
i
=
MultiByteToWideChar
(
cp
,
0
,
bufA
,
p
-
bufA
,
buf
,
noChars
);
HeapFree
(
GetProcessHeap
(),
0
,
bufA
);
heap_free
(
bufA
);
}
}
else
{
else
{
status
=
WCMD_ReadFile
(
h
,
buf
,
noChars
,
&
charsRead
);
status
=
WCMD_ReadFile
(
h
,
buf
,
noChars
,
&
charsRead
);
...
...
programs/cmd/builtins.c
View file @
08c17ada
...
@@ -243,7 +243,7 @@ void WCMD_choice (const WCHAR * args) {
...
@@ -243,7 +243,7 @@ void WCMD_choice (const WCHAR * args) {
if
(
!*
ptr
||
isspaceW
(
*
ptr
))
{
if
(
!*
ptr
||
isspaceW
(
*
ptr
))
{
WINE_FIXME
(
"bad parameter %s for /C
\n
"
,
wine_dbgstr_w
(
ptr
));
WINE_FIXME
(
"bad parameter %s for /C
\n
"
,
wine_dbgstr_w
(
ptr
));
HeapFree
(
GetProcessHeap
(),
0
,
my_command
);
heap_free
(
my_command
);
return
;
return
;
}
}
...
@@ -280,7 +280,7 @@ void WCMD_choice (const WCHAR * args) {
...
@@ -280,7 +280,7 @@ void WCMD_choice (const WCHAR * args) {
if
(
!
opt_default
||
(
*
ptr
!=
','
))
{
if
(
!
opt_default
||
(
*
ptr
!=
','
))
{
WINE_FIXME
(
"bad option %s for /T
\n
"
,
opt_default
?
wine_dbgstr_w
(
ptr
)
:
""
);
WINE_FIXME
(
"bad option %s for /T
\n
"
,
opt_default
?
wine_dbgstr_w
(
ptr
)
:
""
);
HeapFree
(
GetProcessHeap
(),
0
,
my_command
);
heap_free
(
my_command
);
return
;
return
;
}
}
ptr
++
;
ptr
++
;
...
@@ -299,7 +299,7 @@ void WCMD_choice (const WCHAR * args) {
...
@@ -299,7 +299,7 @@ void WCMD_choice (const WCHAR * args) {
default:
default:
WINE_FIXME
(
"bad parameter: %s
\n
"
,
wine_dbgstr_w
(
ptr
));
WINE_FIXME
(
"bad parameter: %s
\n
"
,
wine_dbgstr_w
(
ptr
));
HeapFree
(
GetProcessHeap
(),
0
,
my_command
);
heap_free
(
my_command
);
return
;
return
;
}
}
}
}
...
@@ -357,7 +357,7 @@ void WCMD_choice (const WCHAR * args) {
...
@@ -357,7 +357,7 @@ void WCMD_choice (const WCHAR * args) {
errorlevel
=
(
ptr
-
opt_c
)
+
1
;
errorlevel
=
(
ptr
-
opt_c
)
+
1
;
WINE_TRACE
(
"answer: %d
\n
"
,
errorlevel
);
WINE_TRACE
(
"answer: %d
\n
"
,
errorlevel
);
HeapFree
(
GetProcessHeap
(),
0
,
my_command
);
heap_free
(
my_command
);
return
;
return
;
}
}
else
else
...
@@ -780,7 +780,7 @@ void WCMD_copy(WCHAR * args) {
...
@@ -780,7 +780,7 @@ void WCMD_copy(WCHAR * args) {
}
}
/* Save away the destination name*/
/* Save away the destination name*/
HeapFree
(
GetProcessHeap
(),
0
,
destination
->
name
);
heap_free
(
destination
->
name
);
destination
->
name
=
heap_strdupW
(
destname
);
destination
->
name
=
heap_strdupW
(
destname
);
WINE_TRACE
(
"Resolved destination is '%s' (calc later %d)
\n
"
,
WINE_TRACE
(
"Resolved destination is '%s' (calc later %d)
\n
"
,
wine_dbgstr_w
(
destname
),
appendfirstsource
);
wine_dbgstr_w
(
destname
),
appendfirstsource
);
...
@@ -881,7 +881,7 @@ void WCMD_copy(WCHAR * args) {
...
@@ -881,7 +881,7 @@ void WCMD_copy(WCHAR * args) {
/* If we needed tyo save away the first filename, do it */
/* If we needed tyo save away the first filename, do it */
if
(
appendfirstsource
&&
overwrite
)
{
if
(
appendfirstsource
&&
overwrite
)
{
HeapFree
(
GetProcessHeap
(),
0
,
destination
->
name
);
heap_free
(
destination
->
name
);
destination
->
name
=
heap_strdupW
(
outname
);
destination
->
name
=
heap_strdupW
(
outname
);
WINE_TRACE
(
"Final resolved destination name : '%s'
\n
"
,
wine_dbgstr_w
(
outname
));
WINE_TRACE
(
"Final resolved destination name : '%s'
\n
"
,
wine_dbgstr_w
(
outname
));
appendfirstsource
=
FALSE
;
appendfirstsource
=
FALSE
;
...
@@ -951,14 +951,14 @@ exitreturn:
...
@@ -951,14 +951,14 @@ exitreturn:
prevcopy
=
thiscopy
;
prevcopy
=
thiscopy
;
/* Free up this block*/
/* Free up this block*/
thiscopy
=
thiscopy
->
next
;
thiscopy
=
thiscopy
->
next
;
HeapFree
(
GetProcessHeap
(),
0
,
prevcopy
->
name
);
heap_free
(
prevcopy
->
name
);
HeapFree
(
GetProcessHeap
(),
0
,
prevcopy
);
heap_free
(
prevcopy
);
}
}
/* Free up the destination memory */
/* Free up the destination memory */
if
(
destination
)
{
if
(
destination
)
{
HeapFree
(
GetProcessHeap
(),
0
,
destination
->
name
);
heap_free
(
destination
->
name
);
HeapFree
(
GetProcessHeap
(),
0
,
destination
);
heap_free
(
destination
);
}
}
return
;
return
;
...
@@ -1285,8 +1285,8 @@ static BOOL WCMD_delete_one (const WCHAR *thisArg) {
...
@@ -1285,8 +1285,8 @@ static BOOL WCMD_delete_one (const WCHAR *thisArg) {
tempDir
=
allDirs
->
next
;
tempDir
=
allDirs
->
next
;
found
|=
WCMD_delete_one
(
allDirs
->
dirName
);
found
|=
WCMD_delete_one
(
allDirs
->
dirName
);
HeapFree
(
GetProcessHeap
(),
0
,
allDirs
->
dirName
);
heap_free
(
allDirs
->
dirName
);
HeapFree
(
GetProcessHeap
(),
0
,
allDirs
);
heap_free
(
allDirs
);
allDirs
=
tempDir
;
allDirs
=
tempDir
;
}
}
}
}
...
@@ -1396,7 +1396,7 @@ void WCMD_echo (const WCHAR *args)
...
@@ -1396,7 +1396,7 @@ void WCMD_echo (const WCHAR *args)
&&
origcommand
[
0
]
!=
';'
)
{
&&
origcommand
[
0
]
!=
';'
)
{
if
(
echo_mode
)
WCMD_output
(
WCMD_LoadMessage
(
WCMD_ECHOPROMPT
),
onW
);
if
(
echo_mode
)
WCMD_output
(
WCMD_LoadMessage
(
WCMD_ECHOPROMPT
),
onW
);
else
WCMD_output
(
WCMD_LoadMessage
(
WCMD_ECHOPROMPT
),
offW
);
else
WCMD_output
(
WCMD_LoadMessage
(
WCMD_ECHOPROMPT
),
offW
);
HeapFree
(
GetProcessHeap
(),
0
,
trimmed
);
heap_free
(
trimmed
);
return
;
return
;
}
}
...
@@ -1408,7 +1408,7 @@ void WCMD_echo (const WCHAR *args)
...
@@ -1408,7 +1408,7 @@ void WCMD_echo (const WCHAR *args)
WCMD_output_asis
(
args
);
WCMD_output_asis
(
args
);
WCMD_output_asis
(
newlineW
);
WCMD_output_asis
(
newlineW
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
trimmed
);
heap_free
(
trimmed
);
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -1435,7 +1435,7 @@ static void WCMD_part_execute(CMD_LIST **cmdList, const WCHAR *firstcmd,
...
@@ -1435,7 +1435,7 @@ static void WCMD_part_execute(CMD_LIST **cmdList, const WCHAR *firstcmd,
if
(
executecmds
&&
firstcmd
&&
*
firstcmd
)
{
if
(
executecmds
&&
firstcmd
&&
*
firstcmd
)
{
WCHAR
*
command
=
heap_strdupW
(
firstcmd
);
WCHAR
*
command
=
heap_strdupW
(
firstcmd
);
WCMD_execute
(
firstcmd
,
(
*
cmdList
)
->
redirects
,
cmdList
,
FALSE
);
WCMD_execute
(
firstcmd
,
(
*
cmdList
)
->
redirects
,
cmdList
,
FALSE
);
HeapFree
(
GetProcessHeap
(),
0
,
command
);
heap_free
(
command
);
}
}
...
@@ -1728,7 +1728,7 @@ static void WCMD_parse_line(CMD_LIST *cmdStart,
...
@@ -1728,7 +1728,7 @@ static void WCMD_parse_line(CMD_LIST *cmdStart,
*
cmdEnd
=
thisCmdStart
;
*
cmdEnd
=
thisCmdStart
;
}
}
if
(
varidx
>=
0
)
HeapFree
(
GetProcessHeap
(),
0
,
forloopcontext
.
variable
[
varidx
]);
if
(
varidx
>=
0
)
heap_free
(
forloopcontext
.
variable
[
varidx
]);
/* Restore the original for variable contextx */
/* Restore the original for variable contextx */
forloopcontext
=
oldcontext
;
forloopcontext
=
oldcontext
;
...
@@ -2171,8 +2171,8 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
...
@@ -2171,8 +2171,8 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
/* If we are walking directories, move on to any which remain */
/* If we are walking directories, move on to any which remain */
if
(
dirsToWalk
!=
NULL
)
{
if
(
dirsToWalk
!=
NULL
)
{
DIRECTORY_STACK
*
nextDir
=
dirsToWalk
->
next
;
DIRECTORY_STACK
*
nextDir
=
dirsToWalk
->
next
;
HeapFree
(
GetProcessHeap
(),
0
,
dirsToWalk
->
dirName
);
heap_free
(
dirsToWalk
->
dirName
);
HeapFree
(
GetProcessHeap
(),
0
,
dirsToWalk
);
heap_free
(
dirsToWalk
);
dirsToWalk
=
nextDir
;
dirsToWalk
=
nextDir
;
if
(
dirsToWalk
)
WINE_TRACE
(
"Moving to next directorty to iterate: %s
\n
"
,
if
(
dirsToWalk
)
WINE_TRACE
(
"Moving to next directorty to iterate: %s
\n
"
,
wine_dbgstr_w
(
dirsToWalk
->
dirName
));
wine_dbgstr_w
(
dirsToWalk
->
dirName
));
...
@@ -3446,7 +3446,7 @@ void WCMD_start(const WCHAR *args)
...
@@ -3446,7 +3446,7 @@ void WCMD_start(const WCHAR *args)
WCMD_print_error
();
WCMD_print_error
();
errorlevel
=
9009
;
errorlevel
=
9009
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
cmdline
);
heap_free
(
cmdline
);
}
}
/****************************************************************************
/****************************************************************************
...
...
programs/cmd/directory.c
View file @
08c17ada
...
@@ -208,13 +208,13 @@ static void WCMD_getfileowner(WCHAR *filename, WCHAR *owner, int ownerlen) {
...
@@ -208,13 +208,13 @@ static void WCMD_getfileowner(WCHAR *filename, WCHAR *owner, int ownerlen) {
/* Get the owners security descriptor */
/* Get the owners security descriptor */
if
(
!
GetFileSecurityW
(
filename
,
OWNER_SECURITY_INFORMATION
,
secBuffer
,
if
(
!
GetFileSecurityW
(
filename
,
OWNER_SECURITY_INFORMATION
,
secBuffer
,
sizeNeeded
,
&
sizeNeeded
))
{
sizeNeeded
,
&
sizeNeeded
))
{
HeapFree
(
GetProcessHeap
(),
0
,
secBuffer
);
heap_free
(
secBuffer
);
return
;
return
;
}
}
/* Get the SID from the SD */
/* Get the SID from the SD */
if
(
!
GetSecurityDescriptorOwner
(
secBuffer
,
&
pSID
,
&
defaulted
))
{
if
(
!
GetSecurityDescriptorOwner
(
secBuffer
,
&
pSID
,
&
defaulted
))
{
HeapFree
(
GetProcessHeap
(),
0
,
secBuffer
);
heap_free
(
secBuffer
);
return
;
return
;
}
}
...
@@ -223,7 +223,7 @@ static void WCMD_getfileowner(WCHAR *filename, WCHAR *owner, int ownerlen) {
...
@@ -223,7 +223,7 @@ static void WCMD_getfileowner(WCHAR *filename, WCHAR *owner, int ownerlen) {
static
const
WCHAR
fmt
[]
=
{
'%'
,
's'
,
'%'
,
'c'
,
'%'
,
's'
,
'\0'
};
static
const
WCHAR
fmt
[]
=
{
'%'
,
's'
,
'%'
,
'c'
,
'%'
,
's'
,
'\0'
};
snprintfW
(
owner
,
ownerlen
,
fmt
,
domain
,
'\\'
,
name
);
snprintfW
(
owner
,
ownerlen
,
fmt
,
domain
,
'\\'
,
name
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
secBuffer
);
heap_free
(
secBuffer
);
}
}
return
;
return
;
}
}
...
@@ -477,7 +477,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
...
@@ -477,7 +477,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
}
}
}
}
}
}
HeapFree
(
GetProcessHeap
(),
0
,
fd
);
heap_free
(
fd
);
/* When recursing, look in all subdirectories for matches */
/* When recursing, look in all subdirectories for matches */
if
(
recurse
)
{
if
(
recurse
)
{
...
@@ -530,9 +530,9 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
...
@@ -530,9 +530,9 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
dirStack
=
WCMD_list_directory
(
thisDir
,
1
);
dirStack
=
WCMD_list_directory
(
thisDir
,
1
);
while
(
thisDir
!=
dirStack
)
{
while
(
thisDir
!=
dirStack
)
{
DIRECTORY_STACK
*
tempDir
=
thisDir
->
next
;
DIRECTORY_STACK
*
tempDir
=
thisDir
->
next
;
HeapFree
(
GetProcessHeap
(),
0
,
thisDir
->
dirName
);
heap_free
(
thisDir
->
dirName
);
HeapFree
(
GetProcessHeap
(),
0
,
thisDir
->
fileName
);
heap_free
(
thisDir
->
fileName
);
HeapFree
(
GetProcessHeap
(),
0
,
thisDir
);
heap_free
(
thisDir
);
thisDir
=
tempDir
;
thisDir
=
tempDir
;
}
}
}
}
...
@@ -935,8 +935,8 @@ exit:
...
@@ -935,8 +935,8 @@ exit:
while
(
fullParms
!=
NULL
)
{
while
(
fullParms
!=
NULL
)
{
prevEntry
=
fullParms
;
prevEntry
=
fullParms
;
fullParms
=
prevEntry
->
next
;
fullParms
=
prevEntry
->
next
;
HeapFree
(
GetProcessHeap
(),
0
,
prevEntry
->
dirName
);
heap_free
(
prevEntry
->
dirName
);
HeapFree
(
GetProcessHeap
(),
0
,
prevEntry
->
fileName
);
heap_free
(
prevEntry
->
fileName
);
HeapFree
(
GetProcessHeap
(),
0
,
prevEntry
);
heap_free
(
prevEntry
);
}
}
}
}
programs/cmd/wcmd.h
View file @
08c17ada
...
@@ -128,6 +128,11 @@ void WCMD_execute (const WCHAR *orig_command, const WCHAR *redirects,
...
@@ -128,6 +128,11 @@ void WCMD_execute (const WCHAR *orig_command, const WCHAR *redirects,
void
*
heap_alloc
(
size_t
);
void
*
heap_alloc
(
size_t
);
static
inline
BOOL
heap_free
(
void
*
mem
)
{
return
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
}
static
inline
WCHAR
*
heap_strdupW
(
const
WCHAR
*
str
)
static
inline
WCHAR
*
heap_strdupW
(
const
WCHAR
*
str
)
{
{
WCHAR
*
ret
=
NULL
;
WCHAR
*
ret
=
NULL
;
...
...
programs/cmd/wcmdmain.c
View file @
08c17ada
...
@@ -777,9 +777,9 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start)
...
@@ -777,9 +777,9 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start)
thisVarContents
+
(
lastFound
-
searchIn
));
thisVarContents
+
(
lastFound
-
searchIn
));
strcatW
(
outputposn
,
s
);
strcatW
(
outputposn
,
s
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
s
);
heap_free
(
s
);
HeapFree
(
GetProcessHeap
(),
0
,
searchIn
);
heap_free
(
searchIn
);
HeapFree
(
GetProcessHeap
(),
0
,
searchFor
);
heap_free
(
searchFor
);
}
}
return
start
;
return
start
;
}
}
...
@@ -1330,8 +1330,8 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
...
@@ -1330,8 +1330,8 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
WINE_TRACE
(
"Got directory %s as %s
\n
"
,
wine_dbgstr_w
(
envvar
),
wine_dbgstr_w
(
cmd
));
WINE_TRACE
(
"Got directory %s as %s
\n
"
,
wine_dbgstr_w
(
envvar
),
wine_dbgstr_w
(
cmd
));
status
=
SetCurrentDirectoryW
(
cmd
);
status
=
SetCurrentDirectoryW
(
cmd
);
if
(
!
status
)
WCMD_print_error
();
if
(
!
status
)
WCMD_print_error
();
HeapFree
(
GetProcessHeap
(),
0
,
cmd
);
heap_free
(
cmd
);
HeapFree
(
GetProcessHeap
(),
0
,
new_redir
);
heap_free
(
new_redir
);
return
;
return
;
}
}
...
@@ -1351,8 +1351,8 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
...
@@ -1351,8 +1351,8 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
FILE_ATTRIBUTE_NORMAL
|
FILE_FLAG_DELETE_ON_CLOSE
,
NULL
);
FILE_ATTRIBUTE_NORMAL
|
FILE_FLAG_DELETE_ON_CLOSE
,
NULL
);
if
(
h
==
INVALID_HANDLE_VALUE
)
{
if
(
h
==
INVALID_HANDLE_VALUE
)
{
WCMD_print_error
();
WCMD_print_error
();
HeapFree
(
GetProcessHeap
(),
0
,
cmd
);
heap_free
(
cmd
);
HeapFree
(
GetProcessHeap
(),
0
,
new_redir
);
heap_free
(
new_redir
);
return
;
return
;
}
}
SetStdHandle
(
STD_INPUT_HANDLE
,
h
);
SetStdHandle
(
STD_INPUT_HANDLE
,
h
);
...
@@ -1366,8 +1366,8 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
...
@@ -1366,8 +1366,8 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
&
sa
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
&
sa
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
h
==
INVALID_HANDLE_VALUE
)
{
if
(
h
==
INVALID_HANDLE_VALUE
)
{
WCMD_print_error
();
WCMD_print_error
();
HeapFree
(
GetProcessHeap
(),
0
,
cmd
);
heap_free
(
cmd
);
HeapFree
(
GetProcessHeap
(),
0
,
new_redir
);
heap_free
(
new_redir
);
return
;
return
;
}
}
SetStdHandle
(
STD_INPUT_HANDLE
,
h
);
SetStdHandle
(
STD_INPUT_HANDLE
,
h
);
...
@@ -1412,8 +1412,8 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
...
@@ -1412,8 +1412,8 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
h
==
INVALID_HANDLE_VALUE
)
{
if
(
h
==
INVALID_HANDLE_VALUE
)
{
WCMD_print_error
();
WCMD_print_error
();
HeapFree
(
GetProcessHeap
(),
0
,
cmd
);
heap_free
(
cmd
);
HeapFree
(
GetProcessHeap
(),
0
,
new_redir
);
heap_free
(
new_redir
);
return
;
return
;
}
}
if
(
SetFilePointer
(
h
,
0
,
NULL
,
FILE_END
)
==
if
(
SetFilePointer
(
h
,
0
,
NULL
,
FILE_END
)
==
...
@@ -1599,8 +1599,8 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
...
@@ -1599,8 +1599,8 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
WCMD_run_program
(
whichcmd
,
FALSE
);
WCMD_run_program
(
whichcmd
,
FALSE
);
echo_mode
=
prev_echo_mode
;
echo_mode
=
prev_echo_mode
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
cmd
);
heap_free
(
cmd
);
HeapFree
(
GetProcessHeap
(),
0
,
new_redir
);
heap_free
(
new_redir
);
/* Restore old handles */
/* Restore old handles */
for
(
i
=
0
;
i
<
3
;
i
++
)
{
for
(
i
=
0
;
i
<
3
;
i
++
)
{
...
@@ -2293,9 +2293,9 @@ void WCMD_free_commands(CMD_LIST *cmds) {
...
@@ -2293,9 +2293,9 @@ void WCMD_free_commands(CMD_LIST *cmds) {
while
(
cmds
)
{
while
(
cmds
)
{
CMD_LIST
*
thisCmd
=
cmds
;
CMD_LIST
*
thisCmd
=
cmds
;
cmds
=
cmds
->
nextcommand
;
cmds
=
cmds
->
nextcommand
;
HeapFree
(
GetProcessHeap
(),
0
,
thisCmd
->
command
);
heap_free
(
thisCmd
->
command
);
HeapFree
(
GetProcessHeap
(),
0
,
thisCmd
->
redirects
);
heap_free
(
thisCmd
->
redirects
);
HeapFree
(
GetProcessHeap
(),
0
,
thisCmd
);
heap_free
(
thisCmd
);
}
}
}
}
...
@@ -2561,7 +2561,7 @@ int wmain (int argc, WCHAR *argvW[])
...
@@ -2561,7 +2561,7 @@ int wmain (int argc, WCHAR *argvW[])
WCMD_free_commands
(
toExecute
);
WCMD_free_commands
(
toExecute
);
toExecute
=
NULL
;
toExecute
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
cmd
);
heap_free
(
cmd
);
return
errorlevel
;
return
errorlevel
;
}
}
...
@@ -2647,7 +2647,7 @@ int wmain (int argc, WCHAR *argvW[])
...
@@ -2647,7 +2647,7 @@ int wmain (int argc, WCHAR *argvW[])
WCMD_process_commands
(
toExecute
,
FALSE
,
FALSE
);
WCMD_process_commands
(
toExecute
,
FALSE
,
FALSE
);
WCMD_free_commands
(
toExecute
);
WCMD_free_commands
(
toExecute
);
toExecute
=
NULL
;
toExecute
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
cmd
);
heap_free
(
cmd
);
}
}
/*
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment