Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
9dcd2b3c
Commit
9dcd2b3c
authored
Nov 16, 2022
by
Alex Henrie
Committed by
Alexandre Julliard
Nov 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mstask: Use standard C functions for memory allocation in task.c.
parent
5de27f63
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
29 deletions
+19
-29
mstask_private.h
dlls/mstask/mstask_private.h
+0
-10
task.c
dlls/mstask/task.c
+19
-19
No files found.
dlls/mstask/mstask_private.h
View file @
9dcd2b3c
...
...
@@ -32,14 +32,4 @@ extern HRESULT TaskConstructor(ITaskService *service, const WCHAR *task_name, IT
extern
HRESULT
task_set_trigger
(
ITask
*
task
,
WORD
idx
,
const
TASK_TRIGGER
*
trigger
)
DECLSPEC_HIDDEN
;
extern
HRESULT
task_get_trigger
(
ITask
*
task
,
WORD
idx
,
TASK_TRIGGER
*
trigger
)
DECLSPEC_HIDDEN
;
static
inline
WCHAR
*
heap_strdupW
(
const
WCHAR
*
src
)
{
WCHAR
*
dst
;
unsigned
len
;
if
(
!
src
)
return
NULL
;
len
=
(
lstrlenW
(
src
)
+
1
)
*
sizeof
(
WCHAR
);
if
((
dst
=
heap_alloc
(
len
)))
memcpy
(
dst
,
src
,
len
);
return
dst
;
}
#endif
/* __MSTASK_PRIVATE_H__ */
dlls/mstask/task.c
View file @
9dcd2b3c
...
...
@@ -89,11 +89,11 @@ static void TaskDestructor(TaskImpl *This)
if
(
This
->
action
)
IExecAction_Release
(
This
->
action
);
ITaskDefinition_Release
(
This
->
task
);
heap_
free
(
This
->
data
);
heap_
free
(
This
->
task_name
);
heap_
free
(
This
->
accountName
);
heap_
free
(
This
->
trigger
);
heap_
free
(
This
);
free
(
This
->
data
);
free
(
This
->
task_name
);
free
(
This
->
accountName
);
free
(
This
->
trigger
);
free
(
This
);
InterlockedDecrement
(
&
dll_ref
);
}
...
...
@@ -322,9 +322,9 @@ static HRESULT WINAPI MSTASK_ITask_CreateTrigger(ITask *iface, WORD *idx, ITaskT
if
(
hr
!=
S_OK
)
return
hr
;
if
(
This
->
trigger
)
new_trigger
=
heap_
realloc
(
This
->
trigger
,
sizeof
(
This
->
trigger
[
0
])
*
(
This
->
trigger_count
+
1
));
new_trigger
=
realloc
(
This
->
trigger
,
sizeof
(
This
->
trigger
[
0
])
*
(
This
->
trigger_count
+
1
));
else
new_trigger
=
heap_
alloc
(
sizeof
(
This
->
trigger
[
0
]));
new_trigger
=
m
alloc
(
sizeof
(
This
->
trigger
[
0
]));
if
(
!
new_trigger
)
{
ITaskTrigger_Release
(
*
task_trigger
);
...
...
@@ -365,7 +365,7 @@ static HRESULT WINAPI MSTASK_ITask_DeleteTrigger(ITask *iface, WORD idx)
This
->
trigger_count
--
;
memmove
(
&
This
->
trigger
[
idx
],
&
This
->
trigger
[
idx
+
1
],
(
This
->
trigger_count
-
idx
)
*
sizeof
(
This
->
trigger
[
0
]));
/* this shouldn't fail in practice since we're shrinking the memory block */
This
->
trigger
=
heap_
realloc
(
This
->
trigger
,
sizeof
(
This
->
trigger
[
0
])
*
This
->
trigger_count
);
This
->
trigger
=
realloc
(
This
->
trigger
,
sizeof
(
This
->
trigger
[
0
])
*
This
->
trigger_count
);
return
S_OK
;
}
...
...
@@ -829,8 +829,8 @@ static HRESULT WINAPI MSTASK_ITask_SetWorkItemData(ITask *iface, WORD count, BYT
{
if
(
!
data
)
return
E_INVALIDARG
;
heap_
free
(
This
->
data
);
This
->
data
=
heap_
alloc
(
count
);
free
(
This
->
data
);
This
->
data
=
m
alloc
(
count
);
if
(
!
This
->
data
)
return
E_OUTOFMEMORY
;
memcpy
(
This
->
data
,
data
,
count
);
This
->
data_count
=
count
;
...
...
@@ -839,7 +839,7 @@ static HRESULT WINAPI MSTASK_ITask_SetWorkItemData(ITask *iface, WORD count, BYT
{
if
(
data
)
return
E_INVALIDARG
;
heap_
free
(
This
->
data
);
free
(
This
->
data
);
This
->
data
=
NULL
;
This
->
data_count
=
0
;
}
...
...
@@ -933,11 +933,11 @@ static HRESULT WINAPI MSTASK_ITask_SetAccountInformation(
FIXME
(
"Partial stub ignores passwords
\n
"
);
n
=
(
lstrlenW
(
pwszAccountName
)
+
1
);
tmp_account_name
=
heap_
alloc
(
n
*
sizeof
(
WCHAR
));
tmp_account_name
=
m
alloc
(
n
*
sizeof
(
WCHAR
));
if
(
!
tmp_account_name
)
return
E_OUTOFMEMORY
;
lstrcpyW
(
tmp_account_name
,
pwszAccountName
);
heap_
free
(
This
->
accountName
);
free
(
This
->
accountName
);
This
->
accountName
=
tmp_account_name
;
This
->
is_dirty
=
TRUE
;
return
S_OK
;
...
...
@@ -983,7 +983,7 @@ static HRESULT WINAPI MSTASK_ITask_SetApplicationName(ITask *iface, LPCWSTR appn
{
LPWSTR
tmp_name
;
tmp_name
=
heap_
alloc
(
len
*
sizeof
(
WCHAR
));
tmp_name
=
m
alloc
(
len
*
sizeof
(
WCHAR
));
if
(
!
tmp_name
)
return
E_OUTOFMEMORY
;
len
=
SearchPathW
(
NULL
,
appname
,
NULL
,
len
,
tmp_name
,
NULL
);
...
...
@@ -995,7 +995,7 @@ static HRESULT WINAPI MSTASK_ITask_SetApplicationName(ITask *iface, LPCWSTR appn
else
hr
=
HRESULT_FROM_WIN32
(
GetLastError
());
heap_
free
(
tmp_name
);
free
(
tmp_name
);
return
hr
;
}
...
...
@@ -1792,8 +1792,8 @@ failed:
DeleteFileW
(
task_name
);
else
if
(
remember
)
{
heap_
free
(
This
->
task_name
);
This
->
task_name
=
heap_strdupW
(
task_name
);
free
(
This
->
task_name
);
This
->
task_name
=
wcsdup
(
task_name
);
}
}
return
hr
;
...
...
@@ -1901,7 +1901,7 @@ HRESULT TaskConstructor(ITaskService *service, const WCHAR *name, ITask **task)
hr
=
ITaskService_NewTask
(
service
,
0
,
&
taskdef
);
if
(
hr
!=
S_OK
)
return
hr
;
This
=
heap_
alloc
(
sizeof
(
*
This
));
This
=
m
alloc
(
sizeof
(
*
This
));
if
(
!
This
)
{
ITaskDefinition_Release
(
taskdef
);
...
...
@@ -1914,7 +1914,7 @@ HRESULT TaskConstructor(ITaskService *service, const WCHAR *name, ITask **task)
This
->
task
=
taskdef
;
This
->
data
=
NULL
;
This
->
data_count
=
0
;
This
->
task_name
=
heap_strdupW
(
task_name
);
This
->
task_name
=
wcsdup
(
task_name
);
This
->
flags
=
0
;
This
->
status
=
SCHED_S_TASK_NOT_SCHEDULED
;
This
->
exit_code
=
0
;
...
...
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