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
4406762d
Commit
4406762d
authored
Jul 08, 2015
by
Piotr Caban
Committed by
Alexandre Julliard
Jul 08, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcirt: Fix leak in ~ios and ios::init implementation.
parent
849bb99b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
msvcirt.c
dlls/msvcirt/msvcirt.c
+4
-2
msvcirt.c
dlls/msvcirt/tests/msvcirt.c
+5
-3
No files found.
dlls/msvcirt/msvcirt.c
View file @
4406762d
...
...
@@ -172,6 +172,8 @@ streambuf* __thiscall streambuf_assign(streambuf *this, const streambuf *rhs)
/* ??_Estreambuf@@UAEPAXI@Z */
DEFINE_THISCALL_WRAPPER
(
streambuf_vector_dtor
,
8
)
#define call_streambuf_vector_dtor(this, flags) CALL_VTBL_FUNC(this, 0,\
streambuf*, (streambuf*, unsigned int), (this, flags))
streambuf
*
__thiscall
streambuf_vector_dtor
(
streambuf
*
this
,
unsigned
int
flags
)
{
TRACE
(
"(%p %x)
\n
"
,
this
,
flags
);
...
...
@@ -753,7 +755,7 @@ void __thiscall ios_dtor(ios *this)
{
TRACE
(
"(%p)
\n
"
,
this
);
if
(
this
->
delbuf
&&
this
->
sb
)
MSVCRT_operator_delete
(
this
->
sb
);
call_streambuf_vector_dtor
(
this
->
sb
,
1
);
this
->
sb
=
NULL
;
this
->
state
=
IOSTATE_badbit
;
DeleteCriticalSection
(
&
this
->
lock
);
...
...
@@ -958,7 +960,7 @@ void __thiscall ios_init(ios *this, streambuf *sb)
{
TRACE
(
"(%p %p)
\n
"
,
this
,
sb
);
if
(
this
->
delbuf
&&
this
->
sb
)
MSVCRT_operator_delete
(
this
->
sb
);
call_streambuf_vector_dtor
(
this
->
sb
,
1
);
this
->
sb
=
sb
;
if
(
sb
==
NULL
)
this
->
state
|=
IOSTATE_badbit
;
...
...
dlls/msvcirt/tests/msvcirt.c
View file @
4406762d
...
...
@@ -813,8 +813,8 @@ static void test_ios(void)
memset
(
&
ios_obj
,
0xab
,
sizeof
(
ios
));
memset
(
&
ios_obj2
,
0xab
,
sizeof
(
ios
));
psb
=
p_operator_new
(
sizeof
(
streambuf
));
if
(
psb
)
call_func1
(
p_streambuf_ctor
,
psb
);
ok
(
psb
!=
NULL
,
"failed to allocate streambuf object
\n
"
);
call_func1
(
p_streambuf_ctor
,
psb
);
/* constructor/destructor */
call_func2
(
p_ios_sb_ctor
,
&
ios_obj
,
NULL
);
...
...
@@ -857,10 +857,12 @@ static void test_ios(void)
ok
(
ios_obj
.
sb
==
NULL
,
"expected %p got %p
\n
"
,
NULL
,
ios_obj
.
sb
);
ok
(
ios_obj
.
state
==
(
0x8
|
IOSTATE_badbit
),
"expected %x got %x
\n
"
,
(
0x8
|
IOSTATE_badbit
),
ios_obj
.
state
);
ios_obj
.
sb
=
psb
;
ios_obj
.
delbuf
=
1
;
ios_obj
.
delbuf
=
0
;
call_func2
(
p_ios_init
,
&
ios_obj
,
psb
);
ok
(
ios_obj
.
sb
==
psb
,
"expected %p got %p
\n
"
,
psb
,
ios_obj
.
sb
);
ok
(
ios_obj
.
state
==
0x8
,
"expected %x got %x
\n
"
,
0x8
,
ios_obj
.
state
);
ios_obj
.
delbuf
=
1
;
call_func1
(
p_ios_dtor
,
&
ios_obj
);
/* copy constructor */
call_func2
(
p_ios_copy_ctor
,
&
ios_obj
,
&
ios_obj2
);
...
...
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