Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
go-systemd
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
le
go-systemd
Commits
1cbd13e6
Commit
1cbd13e6
authored
8 years ago
by
Luca Bruno
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #194 from amenzhinsky/master
sdjournal: fix memory leak in cursor handling
parents
5c49e485
c064913e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sdjournal/journal.go
+5
-2
5 additions, 2 deletions
sdjournal/journal.go
with
5 additions
and
2 deletions
sdjournal/journal.go
+
5
−
2
View file @
1cbd13e6
...
...
@@ -736,6 +736,8 @@ func (j *Journal) GetEntry() (*JournalEntry, error) {
entry
.
MonotonicTimestamp
=
uint64
(
monotonicUsec
)
var
c
*
C
.
char
defer
C
.
free
(
unsafe
.
Pointer
(
c
))
r
=
C
.
my_sd_journal_get_cursor
(
sd_journal_get_cursor
,
j
.
cjournal
,
&
c
)
if
r
<
0
{
return
nil
,
fmt
.
Errorf
(
"failed to get cursor: %d"
,
syscall
.
Errno
(
-
r
))
...
...
@@ -834,13 +836,14 @@ func (j *Journal) GetMonotonicUsec() (uint64, error) {
// GetCursor gets the cursor of the current journal entry.
func
(
j
*
Journal
)
GetCursor
()
(
string
,
error
)
{
var
d
*
C
.
char
sd_journal_get_cursor
,
err
:=
j
.
getFunction
(
"sd_journal_get_cursor"
)
if
err
!=
nil
{
return
""
,
err
}
var
d
*
C
.
char
defer
C
.
free
(
unsafe
.
Pointer
(
d
))
j
.
mu
.
Lock
()
r
:=
C
.
my_sd_journal_get_cursor
(
sd_journal_get_cursor
,
j
.
cjournal
,
&
d
)
j
.
mu
.
Unlock
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment