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
55c5f756
Commit
55c5f756
authored
Apr 17, 2015
by
Jeff Hostetler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Attempt to fix Windows TLS memory leak.
parent
c332bb70
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
5 deletions
+17
-5
src/global.c
+13
-5
src/global.h
+2
-0
src/win32/pthread.c
+2
-0
No files found.
src/global.c
View file @
55c5f756
...
@@ -270,13 +270,21 @@ git_global_st *git__global_state(void)
...
@@ -270,13 +270,21 @@ git_global_st *git__global_state(void)
return
ptr
;
return
ptr
;
}
}
void
git__free_thread_global_state
(
void
)
{
void
*
ptr
=
TlsGetValue
(
_tls_index
);
if
(
!
ptr
)
return
;
git__global_state_cleanup
(
ptr
);
git__free
(
ptr
);
TlsSetValue
(
_tls_index
,
NULL
);
}
BOOL
WINAPI
DllMain
(
HINSTANCE
dll
,
DWORD
reason
,
LPVOID
reserved
)
BOOL
WINAPI
DllMain
(
HINSTANCE
dll
,
DWORD
reason
,
LPVOID
reserved
)
{
{
if
(
reason
==
DLL_THREAD_DETACH
)
{
if
(
reason
==
DLL_THREAD_DETACH
)
void
*
ptr
=
TlsGetValue
(
_tls_index
);
git__free_thread_global_state
();
git__global_state_cleanup
(
ptr
);
git__free
(
ptr
);
}
return
TRUE
;
return
TRUE
;
}
}
...
...
src/global.h
View file @
55c5f756
...
@@ -32,4 +32,6 @@ typedef void (*git_global_shutdown_fn)(void);
...
@@ -32,4 +32,6 @@ typedef void (*git_global_shutdown_fn)(void);
extern
void
git__on_shutdown
(
git_global_shutdown_fn
callback
);
extern
void
git__on_shutdown
(
git_global_shutdown_fn
callback
);
extern
void
git__free_thread_global_state
(
void
);
#endif
#endif
src/win32/pthread.c
View file @
55c5f756
...
@@ -20,6 +20,8 @@ static DWORD WINAPI git_win32__threadproc(LPVOID lpParameter)
...
@@ -20,6 +20,8 @@ static DWORD WINAPI git_win32__threadproc(LPVOID lpParameter)
thread
->
result
=
thread
->
proc
(
thread
->
param
);
thread
->
result
=
thread
->
proc
(
thread
->
param
);
git__free_thread_global_state
();
return
CLEAN_THREAD_EXIT
;
return
CLEAN_THREAD_EXIT
;
}
}
...
...
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