Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
319ff349
Unverified
Commit
319ff349
authored
4 years ago
by
Edward Thomson
Committed by
GitHub
4 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5892 from libgit2/ethomson/memleak
tests: clean up memory leak, fail on leak for win32
parents
b5dcdad3
1b1e541d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
1 deletions
+19
-1
src/win32/w32_leakcheck.c
+5
-0
src/win32/w32_leakcheck.h
+2
-0
tests/main.c
+9
-0
tests/refs/races.c
+3
-1
No files found.
src/win32/w32_leakcheck.c
View file @
319ff349
...
...
@@ -558,6 +558,11 @@ static void git_win32_leakcheck_global_shutdown(void)
git_win32_leakcheck_stack_cleanup
();
}
bool
git_win32_leakcheck_has_leaks
(
void
)
{
return
(
g_transient_count_total_leaks
>
0
);
}
int
git_win32_leakcheck_global_init
(
void
)
{
git_win32_leakcheck_stacktrace_init
();
...
...
This diff is collapsed.
Click to expand it.
src/win32/w32_leakcheck.h
View file @
319ff349
...
...
@@ -21,6 +21,8 @@ int git_win32_leakcheck_global_init(void);
#include "git2/errors.h"
#include "strnlen.h"
bool
git_win32_leakcheck_has_leaks
(
void
);
/* Stack frames (for stack tracing, below) */
/**
...
...
This diff is collapsed.
Click to expand it.
tests/main.c
View file @
319ff349
#include "clar_libgit2.h"
#include "clar_libgit2_trace.h"
#ifdef GIT_WIN32_LEAKCHECK
# include "win32/w32_leakcheck.h"
#endif
#ifdef _WIN32
int
__cdecl
main
(
int
argc
,
char
*
argv
[])
#else
...
...
@@ -29,6 +33,11 @@ int main(int argc, char *argv[])
cl_global_trace_disable
();
git_libgit2_shutdown
();
#ifdef GIT_WIN32_LEAKCHECK
if
(
git_win32_leakcheck_has_leaks
())
res
=
res
||
1
;
#endif
at_exit_cmd
=
getenv
(
"CLAR_AT_EXIT"
);
if
(
at_exit_cmd
!=
NULL
)
{
int
at_exit
=
system
(
at_exit_cmd
);
...
...
This diff is collapsed.
Click to expand it.
tests/refs/races.c
View file @
319ff349
...
...
@@ -31,10 +31,12 @@ void test_refs_races__create_matching_zero_old(void)
git_oid_fromstr
(
&
zero_id
,
"0000000000000000000000000000000000000000"
);
cl_git_fail
(
git_reference_create_matching
(
&
ref
,
g_repo
,
refname
,
&
id
,
1
,
&
zero_id
,
NULL
));
git_reference_free
(
ref
);
cl_git_pass
(
git_reference_create_matching
(
&
ref
,
g_repo
,
other_refname
,
&
id
,
1
,
&
zero_id
,
NULL
));
cl_git_fail
(
git_reference_create_matching
(
&
ref
,
g_repo
,
other_refname
,
&
id
,
1
,
&
zero_id
,
NULL
)
);
git_reference_free
(
ref
);
cl_git_fail
(
git_reference_create_matching
(
&
ref
,
g_repo
,
other_refname
,
&
id
,
1
,
&
zero_id
,
NULL
));
git_reference_free
(
ref
);
}
...
...
This diff is collapsed.
Click to expand it.
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