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
e119aceb
Commit
e119aceb
authored
Mar 15, 2010
by
Piotr Caban
Committed by
Alexandre Julliard
Mar 16, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Fix some reference leaks.
parent
3c747fec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
19 deletions
+37
-19
typelib.c
dlls/oleaut32/tests/typelib.c
+8
-8
typelib2.c
dlls/oleaut32/typelib2.c
+29
-11
No files found.
dlls/oleaut32/tests/typelib.c
View file @
e119aceb
...
...
@@ -1425,19 +1425,19 @@ static void test_CreateTypeLib(void) {
hres
=
ICreateTypeLib2_SaveAllChanges
(
createtl
);
ok
(
hres
==
S_OK
,
"got %08x
\n
"
,
hres
);
ICreateTypeLib2_Release
(
createtl
);
hres
=
LoadTypeLibEx
(
filenameW
,
REGKIND_NONE
,
&
tl
);
ok
(
hres
==
S_OK
,
"got %08x
\n
"
,
hres
);
ITypeInfo_Release
(
interface2
);
ITypeInfo_Release
(
interface1
);
ITypeInfo_Release
(
dual
);
ITypeInfo_Release
(
dispatch
);
ITypeInfo_Release
(
unknown
);
ok
(
ITypeInfo_Release
(
interface2
)
==
0
,
"Object should be freed
\n
"
);
ok
(
ITypeInfo_Release
(
interface1
)
==
0
,
"Object should be freed
\n
"
);
ok
(
ITypeInfo_Release
(
dual
)
==
0
,
"Object should be freed
\n
"
);
ok
(
ICreateTypeLib2_Release
(
createtl
)
==
0
,
"Object should be freed
\n
"
);
ok
(
ITypeInfo_Release
(
dispatch
)
==
0
,
"Object should be freed
\n
"
);
ok
(
ITypeInfo_Release
(
unknown
)
==
0
,
"Object should be freed
\n
"
);
ITypeLib_Release
(
tl
);
ITypeLib_Release
(
stdole
);
ok
(
ITypeLib_Release
(
tl
)
==
0
,
"Object should be freed
\n
"
);
ok
(
ITypeLib_Release
(
stdole
)
==
0
,
"Object should be freed
\n
"
);
DeleteFileA
(
filename
);
}
...
...
dlls/oleaut32/typelib2.c
View file @
e119aceb
...
...
@@ -1315,7 +1315,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnQueryInterface(
if
(
*
ppvObject
)
{
ICreateType
Lib
2_AddRef
(
iface
);
ICreateType
Info
2_AddRef
(
iface
);
TRACE
(
"-- Interface: (%p)->(%p)
\n
"
,
ppvObject
,
*
ppvObject
);
return
S_OK
;
}
...
...
@@ -1583,8 +1583,10 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddRefTypeInfo(
/* Allocate container GUID */
hres
=
ITypeLib_GetLibAttr
(
container
,
&
tlibattr
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
{
ITypeLib_Release
(
container
);
return
hres
;
}
guid
.
guid
=
tlibattr
->
guid
;
guid
.
hreftype
=
This
->
typelib
->
typelib_guids
*
12
+
2
;
...
...
@@ -1593,6 +1595,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddRefTypeInfo(
guid_offset
=
ctl2_alloc_guid
(
This
->
typelib
,
&
guid
);
if
(
guid_offset
==
-
1
)
{
ITypeLib_ReleaseTLibAttr
(
container
,
tlibattr
);
ITypeLib_Release
(
container
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -1613,6 +1616,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddRefTypeInfo(
||
(
p
=
strrchrW
(
name
,
'\\'
))
==
NULL
)
{
ERR
(
"Error guessing typelib filename
\n
"
);
ITypeLib_ReleaseTLibAttr
(
container
,
tlibattr
);
ITypeLib_Release
(
container
);
return
E_NOTIMPL
;
}
memmove
(
name
,
p
+
1
,
strlenW
(
p
)
*
sizeof
(
WCHAR
));
...
...
@@ -1622,13 +1626,17 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddRefTypeInfo(
tlibattr
->
lcid
,
tlibattr
->
wMajorVerNum
,
tlibattr
->
wMinorVerNum
,
name
);
ITypeLib_ReleaseTLibAttr
(
container
,
tlibattr
);
if
(
import_offset
==
-
1
)
if
(
import_offset
==
-
1
)
{
ITypeLib_Release
(
container
);
return
E_OUTOFMEMORY
;
}
/* Allocate referenced guid */
hres
=
ITypeInfo_GetTypeAttr
(
pTInfo
,
&
typeattr
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
{
ITypeLib_Release
(
container
);
return
hres
;
}
guid
.
guid
=
typeattr
->
guid
;
guid
.
hreftype
=
This
->
typelib
->
typeinfo_guids
*
12
+
1
;
...
...
@@ -1636,8 +1644,10 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddRefTypeInfo(
ITypeInfo_ReleaseTypeAttr
(
pTInfo
,
typeattr
);
guid_offset
=
ctl2_alloc_guid
(
This
->
typelib
,
&
guid
);
if
(
guid_offset
==
-
1
)
if
(
guid_offset
==
-
1
)
{
ITypeLib_Release
(
container
);
return
E_OUTOFMEMORY
;
}
check_guid
=
(
MSFT_GuidEntry
*
)
&
This
->
typelib
->
typelib_segment_data
[
MSFT_SEG_GUID
][
guid_offset
];
if
(
check_guid
->
hreftype
==
guid
.
hreftype
)
...
...
@@ -2390,15 +2400,17 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(
return
hres
;
hres
=
ITypeInfo_GetRefTypeInfo
(
next
,
hreftype
,
&
cur
);
ITypeInfo_Release
(
next
);
if
(
FAILED
(
hres
))
return
hres
;
ITypeInfo_Release
(
next
);
while
(
1
)
{
hres
=
ITypeInfo_GetTypeAttr
(
cur
,
&
typeattr
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
{
ITypeInfo_Release
(
cur
);
return
hres
;
}
if
(
!
memcmp
(
&
typeattr
->
guid
,
&
IID_IDispatch
,
sizeof
(
IDispatch
)))
This
->
typeinfo
->
flags
|=
TYPEFLAG_FDISPATCHABLE
;
...
...
@@ -2409,16 +2421,21 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(
hres
=
ITypeInfo_GetRefTypeOfImplType
(
cur
,
0
,
&
hreftype
);
if
(
hres
==
TYPE_E_ELEMENTNOTFOUND
)
break
;
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
{
ITypeInfo_Release
(
cur
);
return
hres
;
}
hres
=
ITypeInfo_GetRefTypeInfo
(
cur
,
hreftype
,
&
next
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
{
ITypeInfo_Release
(
cur
);
return
hres
;
}
ITypeInfo_Release
(
cur
);
cur
=
next
;
}
ITypeInfo_Release
(
cur
);
}
This
->
typeinfo
->
cbSizeVft
=
(
This
->
typeinfo
->
datatype2
>>
16
)
*
4
;
...
...
@@ -3102,6 +3119,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetRefTypeInfo(
if
(
hRefType
==-
2
&&
This
->
dual
)
{
*
ppTInfo
=
(
ITypeInfo
*
)
&
This
->
dual
->
lpVtblTypeInfo2
;
ITypeInfo_AddRef
(
*
ppTInfo
);
return
S_OK
;
}
...
...
@@ -3207,7 +3225,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetContainingTypeLib(
TRACE
(
"(%p,%p,%p)
\n
"
,
iface
,
ppTLib
,
pIndex
);
*
ppTLib
=
(
ITypeLib
*
)
&
This
->
typelib
->
lpVtblTypeLib2
;
This
->
typelib
->
ref
++
;
ICreateTypeLib_AddRef
((
ICreateTypeLib
*
)
This
->
typelib
)
;
*
pIndex
=
This
->
typeinfo
->
typekind
>>
16
;
return
S_OK
;
...
...
@@ -3656,7 +3674,7 @@ static ICreateTypeInfo2 *ICreateTypeInfo2_Constructor(ICreateTypeLib2Impl *typel
pCreateTypeInfo2Impl
->
ref
=
1
;
pCreateTypeInfo2Impl
->
typelib
=
typelib
;
typelib
->
ref
++
;
ICreateTypeLib_AddRef
((
ICreateTypeLib
*
)
typelib
)
;
nameoffset
=
ctl2_alloc_name
(
typelib
,
szName
);
typeinfo_offset
=
ctl2_alloc_typeinfo
(
typelib
,
nameoffset
);
...
...
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