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
a6584f5e
Commit
a6584f5e
authored
Sep 20, 2004
by
Marcus Meissner
Committed by
Alexandre Julliard
Sep 20, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SafeArrayGetElement on a VARIANT array does not free the previous
VARIANT in the passed pointer. Added testcase.
parent
36420ef4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
5 deletions
+57
-5
safearray.c
dlls/oleaut32/safearray.c
+15
-5
safearray.c
dlls/oleaut32/tests/safearray.c
+42
-0
No files found.
dlls/oleaut32/safearray.c
View file @
a6584f5e
...
...
@@ -342,7 +342,9 @@ static HRESULT SAFEARRAY_DestroyData(SAFEARRAY *psa, ULONG ulStartCell)
while
(
ulCellCount
--
)
{
VariantClear
(
lpVariant
);
HRESULT
hRet
=
VariantClear
(
lpVariant
);
if
(
FAILED
(
hRet
))
FIXME
(
"VariantClear of element failed!
\n
"
);
lpVariant
++
;
}
}
...
...
@@ -369,7 +371,10 @@ static HRESULT SAFEARRAY_CopyData(SAFEARRAY *psa, SAFEARRAY *dest)
while
(
ulCellCount
--
)
{
VariantCopy
(
lpDest
,
lpVariant
);
HRESULT
hRet
;
hRet
=
VariantCopy
(
lpDest
,
lpVariant
);
if
(
FAILED
(
hRet
))
FIXME
(
"VariantCopy failed with 0x%lx
\n
"
,
hRet
);
lpVariant
++
;
lpDest
++
;
}
...
...
@@ -874,8 +879,10 @@ HRESULT WINAPI SafeArrayPutElement(SAFEARRAY *psa, LONG *rgIndices, void *pvData
VARIANT
*
lpVariant
=
(
VARIANT
*
)
pvData
;
VARIANT
*
lpDest
=
(
VARIANT
*
)
lpvDest
;
VariantClear
(
lpDest
);
VariantCopy
(
lpDest
,
lpVariant
);
hRet
=
VariantClear
(
lpDest
);
if
(
FAILED
(
hRet
))
FIXME
(
"VariantClear failed with 0x%lx
\n
"
,
hRet
);
hRet
=
VariantCopy
(
lpDest
,
lpVariant
);
if
(
FAILED
(
hRet
))
FIXME
(
"VariantCopy failed with 0x%lx
\n
"
,
hRet
);
}
else
if
(
psa
->
fFeatures
&
FADF_BSTR
)
{
...
...
@@ -959,7 +966,10 @@ HRESULT WINAPI SafeArrayGetElement(SAFEARRAY *psa, LONG *rgIndices, void *pvData
VARIANT
*
lpVariant
=
(
VARIANT
*
)
lpvSrc
;
VARIANT
*
lpDest
=
(
VARIANT
*
)
pvData
;
VariantCopy
(
lpDest
,
lpVariant
);
/* The original content of pvData is ignored. */
V_VT
(
lpDest
)
=
VT_EMPTY
;
hRet
=
VariantCopy
(
lpDest
,
lpVariant
);
if
(
FAILED
(
hRet
))
FIXME
(
"VariantCopy failed with 0x%lx
\n
"
,
hRet
);
}
else
if
(
psa
->
fFeatures
&
FADF_BSTR
)
{
...
...
dlls/oleaut32/tests/safearray.c
View file @
a6584f5e
...
...
@@ -1087,6 +1087,47 @@ static void test_SafeArrayGetPutElement_IUnknown(void)
ok
(
tunk_xref
==
2
,
"Failed to decrement refcount of iface.
\n
"
);
}
static
void
test_SafeArrayGetPutElement_VARIANT
(
void
)
{
SAFEARRAYBOUND
sab
;
LONG
indices
[
1
];
SAFEARRAY
*
sa
;
HRESULT
hres
;
VARIANT
value
,
gotvalue
;
sab
.
lLbound
=
1
;
sab
.
cElements
=
1
;
sa
=
SafeArrayCreate
(
VT_VARIANT
,
1
,
&
sab
);
ok
(
sa
!=
NULL
,
"VARIANT test couldn't create array
\n
"
);
if
(
!
sa
)
return
;
ok
(
sa
->
cbElements
==
sizeof
(
VARIANT
),
"VARIANT size mismatch
\n
"
);
if
(
sa
->
cbElements
!=
sizeof
(
VARIANT
))
return
;
indices
[
0
]
=
sab
.
lLbound
;
V_VT
(
&
value
)
=
VT_I4
;
V_I4
(
&
value
)
=
0x42424242
;
hres
=
SafeArrayPutElement
(
sa
,
indices
,
&
value
);
ok
(
hres
==
S_OK
,
"Failed to put Variant I4 element hres 0x%lx
\n
"
,
hres
);
V_VT
(
&
gotvalue
)
=
0xdead
;
hres
=
SafeArrayGetElement
(
sa
,
indices
,
&
gotvalue
);
ok
(
hres
==
S_OK
,
"Failed to get variant element at hres 0x%lx
\n
"
,
hres
);
V_VT
(
&
gotvalue
)
=
VT_EMPTY
;
hres
=
SafeArrayGetElement
(
sa
,
indices
,
&
gotvalue
);
ok
(
hres
==
S_OK
,
"Failed to get variant element at hres 0x%lx
\n
"
,
hres
);
if
(
hres
==
S_OK
)
{
ok
(
V_VT
(
&
value
)
==
V_VT
(
&
gotvalue
),
"Got type 0x%x instead of 0x%x
\n
"
,
V_VT
(
&
value
),
V_VT
(
&
gotvalue
));
if
(
V_VT
(
&
value
)
==
V_VT
(
&
gotvalue
))
ok
(
V_I4
(
&
value
)
==
V_I4
(
&
gotvalue
),
"Got %ld instead of %d
\n
"
,
V_I4
(
&
value
),
V_VT
(
&
gotvalue
));
}
SafeArrayDestroy
(
sa
);
}
static
void
test_SafeArrayCopyData
(
void
)
{
SAFEARRAYBOUND
sab
[
4
];
...
...
@@ -1520,4 +1561,5 @@ START_TEST(safearray)
test_SafeArrayGetPutElement
();
test_SafeArrayGetPutElement_BSTR
();
test_SafeArrayGetPutElement_IUnknown
();
test_SafeArrayGetPutElement_VARIANT
();
}
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