Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
2814677a
Commit
2814677a
authored
Nov 28, 2017
by
Ulrich Sibiller
Committed by
Mihai Moldovan
Dec 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Loop.cpp: fix more memory leaks
The thread specific stringstream objects on the stack need to be deleted, not just pop()ed. Fixes ArcticaProject/nx-libs#573 (partially)
parent
1c09eab7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
Log.h
nxcomp/src/Log.h
+15
-1
No files found.
nxcomp/src/Log.h
View file @
2814677a
...
@@ -168,7 +168,13 @@ class NXLog
...
@@ -168,7 +168,13 @@ class NXLog
delete
pdt
->
thread_name
;
delete
pdt
->
thread_name
;
while
(
!
pdt
->
buffer
.
empty
())
{
while
(
!
pdt
->
buffer
.
empty
())
{
/*
* get the stringstream object created in new_stack_entry()
* from the stack and delete it after pop()
*/
std
::
stringstream
*
tmp
=
pdt
->
buffer
.
top
();
(
void
)
pdt
->
buffer
.
pop
();
(
void
)
pdt
->
buffer
.
pop
();
delete
tmp
;
}
}
delete
pdt
;
delete
pdt
;
...
@@ -240,7 +246,12 @@ class NXLog
...
@@ -240,7 +246,12 @@ class NXLog
pthread_sigmask
(
SIG_BLOCK
,
&
tmp_signal_mask
,
&
orig_signal_mask
);
pthread_sigmask
(
SIG_BLOCK
,
&
tmp_signal_mask
,
&
orig_signal_mask
);
if
(
!
pdt
->
buffer
.
empty
())
{
if
(
!
pdt
->
buffer
.
empty
())
{
const
std
::
string
str
=
pdt
->
buffer
.
top
()
->
str
();
/*
* get the stringstream object created in new_stack_entry()
* from the stack and delete it after pop()
*/
std
::
stringstream
*
tmp
=
pdt
->
buffer
.
top
();
const
std
::
string
str
=
tmp
->
str
();
if
(
!
str
.
empty
())
if
(
!
str
.
empty
())
{
{
...
@@ -251,6 +262,9 @@ class NXLog
...
@@ -251,6 +262,9 @@ class NXLog
/* Remove from stack. */
/* Remove from stack. */
pdt
->
buffer
.
pop
();
pdt
->
buffer
.
pop
();
/* free memory */
delete
tmp
;
}
}
/* Restore old signal mask. */
/* Restore old signal mask. */
...
...
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