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
b8215658
Commit
b8215658
authored
Apr 19, 2006
by
Mikołaj Zalewski
Committed by
Alexandre Julliard
Apr 20, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: header: Avoid freeing invalid pointers.
parent
a1c98ea8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
header.c
dlls/comctl32/header.c
+14
-7
No files found.
dlls/comctl32/header.c
View file @
b8215658
...
...
@@ -99,7 +99,16 @@ typedef struct
#define HEADER_GetInfoPtr(hwnd) ((HEADER_INFO *)GetWindowLongPtrW(hwnd,0))
static
const
WCHAR
themeClass
[]
=
{
'H'
,
'e'
,
'a'
,
'd'
,
'e'
,
'r'
,
0
};
static
WCHAR
emptyString
[]
=
{
0
};
static
void
HEADER_DisposeItem
(
HEADER_ITEM
*
lpItem
)
{
if
(
lpItem
->
pszText
&&
lpItem
->
pszText
!=
emptyString
&&
lpItem
->
pszText
!=
LPSTR_TEXTCALLBACKW
)
/* covers LPSTR_TEXTCALLBACKA too */
{
Free
(
lpItem
->
pszText
);
}
}
inline
static
LRESULT
HEADER_IndexToOrder
(
HWND
hwnd
,
INT
iItem
)
...
...
@@ -796,8 +805,7 @@ HEADER_DeleteItem (HWND hwnd, WPARAM wParam)
if
(
infoPtr
->
uNumItem
==
1
)
{
TRACE
(
"Simple delete!
\n
"
);
if
(
infoPtr
->
items
[
0
].
pszText
)
Free
(
infoPtr
->
items
[
0
].
pszText
);
HEADER_DisposeItem
(
&
infoPtr
->
items
[
0
]);
Free
(
infoPtr
->
items
);
Free
(
infoPtr
->
order
);
infoPtr
->
items
=
0
;
...
...
@@ -812,8 +820,7 @@ HEADER_DeleteItem (HWND hwnd, WPARAM wParam)
for
(
i
=
0
;
i
<
infoPtr
->
uNumItem
;
i
++
)
TRACE
(
"%d: order=%d, iOrder=%d, ->iOrder=%d
\n
"
,
i
,
infoPtr
->
order
[
i
],
infoPtr
->
items
[
i
].
iOrder
,
infoPtr
->
items
[
infoPtr
->
order
[
i
]].
iOrder
);
if
(
infoPtr
->
items
[
iItem
].
pszText
)
Free
(
infoPtr
->
items
[
iItem
].
pszText
);
HEADER_DisposeItem
(
&
infoPtr
->
items
[
iItem
]);
iOrder
=
infoPtr
->
items
[
iItem
].
iOrder
;
infoPtr
->
uNumItem
--
;
...
...
@@ -1111,7 +1118,7 @@ HEADER_InsertItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
if
(
phdi
->
mask
&
HDI_TEXT
)
{
if
(
!
phdi
->
pszText
)
phdi
->
pszText
=
'\0'
;
/* null pointer check */
if
(
!
phdi
->
pszText
)
phdi
->
pszText
=
emptyString
;
/* null pointer check */
if
(
phdi
->
pszText
!=
LPSTR_TEXTCALLBACKW
)
/* covers != TEXTCALLBACKA too */
{
if
(
bUnicode
)
...
...
@@ -1255,6 +1262,7 @@ HEADER_SetItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
{
if
(
lpItem
->
pszText
)
{
if
(
lpItem
->
pszText
!=
emptyString
&&
lpItem
->
pszText
!=
LPSTR_TEXTCALLBACKW
)
Free
(
lpItem
->
pszText
);
lpItem
->
pszText
=
NULL
;
}
...
...
@@ -1374,8 +1382,7 @@ HEADER_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
if
(
infoPtr
->
items
)
{
lpItem
=
infoPtr
->
items
;
for
(
nItem
=
0
;
nItem
<
infoPtr
->
uNumItem
;
nItem
++
,
lpItem
++
)
{
if
((
lpItem
->
pszText
)
&&
(
lpItem
->
pszText
!=
LPSTR_TEXTCALLBACKW
))
Free
(
lpItem
->
pszText
);
HEADER_DisposeItem
(
lpItem
);
}
Free
(
infoPtr
->
items
);
}
...
...
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