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
afa6cb52
Commit
afa6cb52
authored
Jun 06, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 09, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oledb32: Fix instance leak on error path (Valgrind).
parent
17f27336
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
3 deletions
+45
-3
datainit.c
dlls/oledb32/datainit.c
+19
-2
database.c
dlls/oledb32/tests/database.c
+26
-1
No files found.
dlls/oledb32/datainit.c
View file @
afa6cb52
...
@@ -424,6 +424,7 @@ static HRESULT WINAPI datainit_GetDataSource(IDataInitialize *iface, IUnknown *o
...
@@ -424,6 +424,7 @@ static HRESULT WINAPI datainit_GetDataSource(IDataInitialize *iface, IUnknown *o
static
const
WCHAR
providerW
[]
=
{
'P'
,
'r'
,
'o'
,
'v'
,
'i'
,
'd'
,
'e'
,
'r'
,
'='
,
0
};
static
const
WCHAR
providerW
[]
=
{
'P'
,
'r'
,
'o'
,
'v'
,
'i'
,
'd'
,
'e'
,
'r'
,
'='
,
0
};
static
const
WCHAR
msdasqlW
[]
=
{
'M'
,
'S'
,
'D'
,
'A'
,
'S'
,
'Q'
,
'L'
,
0
};
static
const
WCHAR
msdasqlW
[]
=
{
'M'
,
'S'
,
'D'
,
'A'
,
'S'
,
'Q'
,
'L'
,
0
};
datainit
*
This
=
impl_from_IDataInitialize
(
iface
);
datainit
*
This
=
impl_from_IDataInitialize
(
iface
);
BOOL
datasource_created
=
FALSE
;
IDBProperties
*
dbprops
;
IDBProperties
*
dbprops
;
DBPROPSET
*
propset
;
DBPROPSET
*
propset
;
WCHAR
*
prov
=
NULL
;
WCHAR
*
prov
=
NULL
;
...
@@ -511,6 +512,8 @@ static HRESULT WINAPI datainit_GetDataSource(IDataInitialize *iface, IUnknown *o
...
@@ -511,6 +512,8 @@ static HRESULT WINAPI datainit_GetDataSource(IDataInitialize *iface, IUnknown *o
if
(
FAILED
(
hr
)
&&
IsEqualIID
(
riid
,
&
IID_IDBInitialize
))
if
(
FAILED
(
hr
)
&&
IsEqualIID
(
riid
,
&
IID_IDBInitialize
))
hr
=
create_db_init
(
datasource
);
hr
=
create_db_init
(
datasource
);
datasource_created
=
*
datasource
!=
NULL
;
}
}
/* now set properties */
/* now set properties */
...
@@ -521,7 +524,12 @@ static HRESULT WINAPI datainit_GetDataSource(IDataInitialize *iface, IUnknown *o
...
@@ -521,7 +524,12 @@ static HRESULT WINAPI datainit_GetDataSource(IDataInitialize *iface, IUnknown *o
hr
=
IUnknown_QueryInterface
(
*
datasource
,
&
IID_IDBProperties
,
(
void
**
)
&
dbprops
);
hr
=
IUnknown_QueryInterface
(
*
datasource
,
&
IID_IDBProperties
,
(
void
**
)
&
dbprops
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
WARN
(
"provider doesn't support IDBProperties
\n
"
);
ERR
(
"provider doesn't support IDBProperties
\n
"
);
if
(
datasource_created
)
{
IUnknown_Release
(
*
datasource
);
*
datasource
=
NULL
;
}
return
hr
;
return
hr
;
}
}
...
@@ -557,7 +565,16 @@ static HRESULT WINAPI datainit_GetDataSource(IDataInitialize *iface, IUnknown *o
...
@@ -557,7 +565,16 @@ static HRESULT WINAPI datainit_GetDataSource(IDataInitialize *iface, IUnknown *o
hr
=
IDBProperties_SetProperties
(
dbprops
,
1
,
propset
);
hr
=
IDBProperties_SetProperties
(
dbprops
,
1
,
propset
);
free_dbpropset
(
1
,
propset
);
free_dbpropset
(
1
,
propset
);
TRACE
(
"provider ret 0x%08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
ERR
(
"failed to set property, 0x%08x
\n
"
,
hr
);
if
(
datasource_created
)
{
IUnknown_Release
(
*
datasource
);
*
datasource
=
NULL
;
}
break
;
}
}
}
IDBProperties_Release
(
dbprops
);
IDBProperties_Release
(
dbprops
);
...
...
dlls/oledb32/tests/database.c
View file @
afa6cb52
...
@@ -37,6 +37,14 @@ DEFINE_GUID(CSLID_MSDAER, 0xc8b522cf,0x5cf3,0x11ce,0xad,0xe5,0x00,0xaa,0x00,0x44
...
@@ -37,6 +37,14 @@ DEFINE_GUID(CSLID_MSDAER, 0xc8b522cf,0x5cf3,0x11ce,0xad,0xe5,0x00,0xaa,0x00,0x44
static
WCHAR
initstring_default
[]
=
{
'D'
,
'a'
,
't'
,
'a'
,
' '
,
'S'
,
'o'
,
'u'
,
'r'
,
'c'
,
'e'
,
'='
,
'd'
,
'u'
,
'm'
,
'm'
,
'y'
,
';'
,
0
};
static
WCHAR
initstring_default
[]
=
{
'D'
,
'a'
,
't'
,
'a'
,
' '
,
'S'
,
'o'
,
'u'
,
'r'
,
'c'
,
'e'
,
'='
,
'd'
,
'u'
,
'm'
,
'm'
,
'y'
,
';'
,
0
};
#define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__)
static
void
_expect_ref
(
IUnknown
*
obj
,
ULONG
ref
,
int
line
)
{
ULONG
rc
=
IUnknown_AddRef
(
obj
);
IUnknown_Release
(
obj
);
ok_
(
__FILE__
,
line
)(
rc
-
1
==
ref
,
"expected refcount %d, got %d
\n
"
,
ref
,
rc
-
1
);
}
static
void
test_GetDataSource
(
WCHAR
*
initstring
)
static
void
test_GetDataSource
(
WCHAR
*
initstring
)
{
{
IDataInitialize
*
datainit
=
NULL
;
IDataInitialize
*
datainit
=
NULL
;
...
@@ -48,12 +56,17 @@ static void test_GetDataSource(WCHAR *initstring)
...
@@ -48,12 +56,17 @@ static void test_GetDataSource(WCHAR *initstring)
hr
=
CoCreateInstance
(
&
CLSID_MSDAINITIALIZE
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDataInitialize
,(
void
**
)
&
datainit
);
hr
=
CoCreateInstance
(
&
CLSID_MSDAINITIALIZE
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDataInitialize
,(
void
**
)
&
datainit
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
EXPECT_REF
(
datainit
,
1
);
/* a failure to create data source here may indicate provider is simply not present */
/* a failure to create data source here may indicate provider is simply not present */
hr
=
IDataInitialize_GetDataSource
(
datainit
,
NULL
,
CLSCTX_INPROC_SERVER
,
initstring
,
&
IID_IDBInitialize
,
(
IUnknown
**
)
&
dbinit
);
hr
=
IDataInitialize_GetDataSource
(
datainit
,
NULL
,
CLSCTX_INPROC_SERVER
,
initstring
,
&
IID_IDBInitialize
,
(
IUnknown
**
)
&
dbinit
);
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
IDBProperties
*
props
=
NULL
;
IDBProperties
*
props
=
NULL
;
EXPECT_REF
(
datainit
,
1
);
EXPECT_REF
(
dbinit
,
1
);
hr
=
IDBInitialize_QueryInterface
(
dbinit
,
&
IID_IDBProperties
,
(
void
**
)
&
props
);
hr
=
IDBInitialize_QueryInterface
(
dbinit
,
&
IID_IDBProperties
,
(
void
**
)
&
props
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
...
@@ -62,6 +75,8 @@ static void test_GetDataSource(WCHAR *initstring)
...
@@ -62,6 +75,8 @@ static void test_GetDataSource(WCHAR *initstring)
DBPROPINFOSET
*
pInfoset
;
DBPROPINFOSET
*
pInfoset
;
OLECHAR
*
ary
;
OLECHAR
*
ary
;
EXPECT_REF
(
dbinit
,
2
);
EXPECT_REF
(
props
,
2
);
hr
=
IDBProperties_GetPropertyInfo
(
props
,
0
,
NULL
,
&
cnt
,
&
pInfoset
,
&
ary
);
hr
=
IDBProperties_GetPropertyInfo
(
props
,
0
,
NULL
,
&
cnt
,
&
pInfoset
,
&
ary
);
todo_wine
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
todo_wine
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
if
(
hr
==
S_OK
)
...
@@ -80,9 +95,11 @@ static void test_GetDataSource(WCHAR *initstring)
...
@@ -80,9 +95,11 @@ static void test_GetDataSource(WCHAR *initstring)
IDBProperties_Release
(
props
);
IDBProperties_Release
(
props
);
}
}
EXPECT_REF
(
dbinit
,
1
);
IDBInitialize_Release
(
dbinit
);
IDBInitialize_Release
(
dbinit
);
}
}
EXPECT_REF
(
datainit
,
1
);
IDataInitialize_Release
(
datainit
);
IDataInitialize_Release
(
datainit
);
}
}
...
@@ -186,7 +203,7 @@ static void test_initializationstring(void)
...
@@ -186,7 +203,7 @@ static void test_initializationstring(void)
static
const
WCHAR
initstring_sqloledb
[]
=
{
'P'
,
'r'
,
'o'
,
'v'
,
'i'
,
'd'
,
'e'
,
'r'
,
'='
,
'S'
,
'Q'
,
'L'
,
'O'
,
'L'
,
'E'
,
'D'
,
'B'
,
'.'
,
'1'
,
';'
,
static
const
WCHAR
initstring_sqloledb
[]
=
{
'P'
,
'r'
,
'o'
,
'v'
,
'i'
,
'd'
,
'e'
,
'r'
,
'='
,
'S'
,
'Q'
,
'L'
,
'O'
,
'L'
,
'E'
,
'D'
,
'B'
,
'.'
,
'1'
,
';'
,
'D'
,
'a'
,
't'
,
'a'
,
' '
,
'S'
,
'o'
,
'u'
,
'r'
,
'c'
,
'e'
,
'='
,
'd'
,
'u'
,
'm'
,
'm'
,
'y'
,
0
};
'D'
,
'a'
,
't'
,
'a'
,
' '
,
'S'
,
'o'
,
'u'
,
'r'
,
'c'
,
'e'
,
'='
,
'd'
,
'u'
,
'm'
,
'm'
,
'y'
,
0
};
IDataInitialize
*
datainit
=
NULL
;
IDataInitialize
*
datainit
=
NULL
;
IDBInitialize
*
dbinit
=
NULL
;
IDBInitialize
*
dbinit
;
HRESULT
hr
;
HRESULT
hr
;
WCHAR
*
initstring
=
NULL
;
WCHAR
*
initstring
=
NULL
;
...
@@ -194,10 +211,16 @@ static void test_initializationstring(void)
...
@@ -194,10 +211,16 @@ static void test_initializationstring(void)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
EXPECT_REF
(
datainit
,
1
);
dbinit
=
NULL
;
hr
=
IDataInitialize_GetDataSource
(
datainit
,
NULL
,
CLSCTX_INPROC_SERVER
,
initstring_default
,
hr
=
IDataInitialize_GetDataSource
(
datainit
,
NULL
,
CLSCTX_INPROC_SERVER
,
initstring_default
,
&
IID_IDBInitialize
,
(
IUnknown
**
)
&
dbinit
);
&
IID_IDBInitialize
,
(
IUnknown
**
)
&
dbinit
);
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
EXPECT_REF
(
datainit
,
1
);
EXPECT_REF
(
dbinit
,
1
);
hr
=
IDataInitialize_GetInitializationString
(
datainit
,
(
IUnknown
*
)
dbinit
,
0
,
&
initstring
);
hr
=
IDataInitialize_GetInitializationString
(
datainit
,
(
IUnknown
*
)
dbinit
,
0
,
&
initstring
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
if
(
hr
==
S_OK
)
...
@@ -210,6 +233,8 @@ static void test_initializationstring(void)
...
@@ -210,6 +233,8 @@ static void test_initializationstring(void)
IDBInitialize_Release
(
dbinit
);
IDBInitialize_Release
(
dbinit
);
}
}
else
ok
(
dbinit
==
NULL
,
"got %p
\n
"
,
dbinit
);
IDataInitialize_Release
(
datainit
);
IDataInitialize_Release
(
datainit
);
}
}
...
...
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