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
300cc0fe
Commit
300cc0fe
authored
Jan 06, 2010
by
James Hawkins
Committed by
Alexandre Julliard
Jan 07, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cabinet: Fix several file list leaks in the extract tests.
parent
ced5081e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
1 deletion
+30
-1
extract.c
dlls/cabinet/tests/extract.c
+30
-1
No files found.
dlls/cabinet/tests/extract.c
View file @
300cc0fe
...
...
@@ -329,6 +329,26 @@ static BOOL check_list(struct FILELIST **node, const char *filename, BOOL do_ext
return
TRUE
;
}
static
void
free_file_node
(
struct
FILELIST
*
node
)
{
HeapFree
(
GetProcessHeap
(),
0
,
node
->
FileName
);
HeapFree
(
GetProcessHeap
(),
0
,
node
);
}
static
void
free_file_list
(
SESSION
*
session
)
{
struct
FILELIST
*
next
,
*
curr
=
session
->
FileList
;
while
(
curr
)
{
next
=
curr
->
next
;
free_file_node
(
curr
);
curr
=
next
;
}
session
->
FileList
=
NULL
;
}
static
void
test_Extract
(
void
)
{
SESSION
session
;
...
...
@@ -370,6 +390,7 @@ static void test_Extract(void)
ok
(
check_list
(
&
node
,
"testdir
\\
c.txt"
,
FALSE
),
"list entry wrong
\n
"
);
ok
(
check_list
(
&
node
,
"b.txt"
,
FALSE
),
"list entry wrong
\n
"
);
ok
(
check_list
(
&
node
,
"a.txt"
,
FALSE
),
"list entry wrong
\n
"
);
free_file_list
(
&
session
);
/* try fill file list operation */
ZeroMemory
(
&
session
,
sizeof
(
SESSION
));
...
...
@@ -454,7 +475,10 @@ static void test_Extract(void)
ok
(
check_list
(
&
node
,
"a.txt"
,
FALSE
),
"list entry wrong
\n
"
);
/* remove two of the files in the list */
node
=
session
.
FileList
->
next
;
session
.
FileList
->
next
=
session
.
FileList
->
next
->
next
;
free_file_node
(
node
);
free_file_node
(
session
.
FileList
->
next
->
next
);
session
.
FileList
->
next
->
next
=
NULL
;
session
.
FilterList
=
NULL
;
CreateDirectoryA
(
"dest"
,
NULL
);
...
...
@@ -482,6 +506,7 @@ static void test_Extract(void)
ok
(
!
check_list
(
&
node
,
"testdir
\\
c.txt"
,
FALSE
),
"list entry wrong
\n
"
);
ok
(
check_list
(
&
node
,
"b.txt"
,
FALSE
),
"list entry wrong
\n
"
);
ok
(
!
check_list
(
&
node
,
"a.txt"
,
FALSE
),
"list entry wrong
\n
"
);
free_file_list
(
&
session
);
session
.
Operation
=
EXTRACT_FILLFILELIST
;
session
.
FileList
=
NULL
;
...
...
@@ -564,6 +589,7 @@ static void test_Extract(void)
ok
(
check_list
(
&
node
,
"testdir
\\
c.txt"
,
FALSE
),
"list entry wrong
\n
"
);
ok
(
check_list
(
&
node
,
"b.txt"
,
FALSE
),
"list entry wrong
\n
"
);
ok
(
check_list
(
&
node
,
"a.txt"
,
FALSE
),
"list entry wrong
\n
"
);
free_file_list
(
&
session
);
/* cabinet does not exist */
ZeroMemory
(
&
session
,
sizeof
(
SESSION
));
...
...
@@ -593,6 +619,7 @@ static void test_Extract(void)
ok
(
!
check_list
(
&
node
,
"testdir
\\
c.txt"
,
FALSE
),
"list entry should not exist
\n
"
);
ok
(
!
check_list
(
&
node
,
"b.txt"
,
FALSE
),
"list entry should not exist
\n
"
);
ok
(
!
check_list
(
&
node
,
"a.txt"
,
FALSE
),
"list entry should not exist
\n
"
);
free_file_list
(
&
session
);
/* first file exists */
createTestFile
(
"dest
\\
a.txt"
);
...
...
@@ -631,6 +658,7 @@ static void test_Extract(void)
ok
(
!
check_list
(
&
node
,
"b.txt"
,
FALSE
),
"list entry should not exist
\n
"
);
}
ok
(
!
check_list
(
&
node
,
"a.txt"
,
FALSE
),
"list entry should not exist
\n
"
);
free_file_list
(
&
session
);
SetFileAttributesA
(
"dest
\\
a.txt"
,
FILE_ATTRIBUTE_NORMAL
);
DeleteFileA
(
"dest
\\
a.txt"
);
...
...
@@ -670,7 +698,8 @@ static void test_Extract(void)
ok
(
!
check_list
(
&
node
,
"testdir
\\
d.txt"
,
FALSE
),
"list entry should not exist
\n
"
);
ok
(
!
check_list
(
&
node
,
"testdir
\\
c.txt"
,
FALSE
),
"list entry wrong
\n
"
);
ok
(
!
check_list
(
&
node
,
"b.txt"
,
FALSE
),
"list entry wrong
\n
"
);
ok
(
check_list
(
&
node
,
"a.txt"
,
TRUE
),
"list entry wrong
\n
"
);
ok
(
!
check_list
(
&
node
,
"a.txt"
,
TRUE
),
"list entry wrong
\n
"
);
free_file_list
(
&
session
);
SetFileAttributesA
(
"dest
\\
testdir
\\
c.txt"
,
FILE_ATTRIBUTE_NORMAL
);
DeleteFileA
(
"dest
\\
testdir
\\
c.txt"
);
...
...
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