|
|
291ba4 |
From 920c28ff705aac74f389b4613815b14b9482e497 Mon Sep 17 00:00:00 2001
|
|
|
291ba4 |
From: Jiri Vymazal <jvymazal@redhat.com>
|
|
|
291ba4 |
Date: Mon, 21 Jan 2019 10:58:03 +0100
|
|
|
291ba4 |
Subject: [PATCH] Added missing free() calls of received journal cursor
|
|
|
291ba4 |
|
|
|
291ba4 |
---
|
|
|
291ba4 |
plugins/imjournal/imjournal.c | 7 +++++--
|
|
|
291ba4 |
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
|
291ba4 |
|
|
|
291ba4 |
diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c
|
|
|
291ba4 |
index a85e521003..f5c2be4b6e 100644
|
|
|
291ba4 |
--- a/plugins/imjournal/imjournal.c
|
|
|
291ba4 |
+++ b/plugins/imjournal/imjournal.c
|
|
|
291ba4 |
@@ -411,8 +411,7 @@ readjournal(void)
|
|
|
291ba4 |
|
|
|
291ba4 |
if (cs.bWorkAroundJournalBug) {
|
|
|
291ba4 |
/* save journal cursor (at this point we can be sure it is valid) */
|
|
|
291ba4 |
- sd_journal_get_cursor(j, &c);
|
|
|
291ba4 |
- if (c) {
|
|
|
552a9e |
+ if (!sd_journal_get_cursor(j, &c)) {
|
|
|
291ba4 |
free(last_cursor);
|
|
|
291ba4 |
last_cursor = c;
|
|
|
291ba4 |
}
|
|
|
291ba4 |
@@ -444,7 +443,9 @@ persistJournalState(void)
|
|
|
291ba4 |
if (!last_cursor)
|
|
|
291ba4 |
ABORT_FINALIZE(RS_RET_OK);
|
|
|
291ba4 |
} else if (trySave) {
|
|
|
291ba4 |
+ free(last_cursor);
|
|
|
291ba4 |
if ((ret = sd_journal_get_cursor(j, &last_cursor))) {
|
|
|
291ba4 |
+ last_cursor = NULL;
|
|
|
291ba4 |
LogError(-ret, RS_RET_ERR, "imjournal: sd_journal_get_cursor() failed");
|
|
|
291ba4 |
ABORT_FINALIZE(RS_RET_ERR);
|
|
|
291ba4 |
}
|
|
|
291ba4 |
@@ -592,6 +593,7 @@ loadJournalState(void)
|
|
|
291ba4 |
iRet = RS_RET_ERR;
|
|
|
291ba4 |
}
|
|
|
291ba4 |
}
|
|
|
291ba4 |
+ free(tmp_cursor);
|
|
|
291ba4 |
}
|
|
|
291ba4 |
} else {
|
|
|
291ba4 |
errmsg.LogError(0, RS_RET_IO_ERROR, "imjournal: "
|
|
|
291ba4 |
@@ -748,6 +750,7 @@ BEGINfreeCnf
|
|
|
291ba4 |
CODESTARTfreeCnf
|
|
|
291ba4 |
free(cs.stateFile);
|
|
|
291ba4 |
free(cs.dfltTag);
|
|
|
291ba4 |
+ free(last_cursor);
|
|
|
291ba4 |
ENDfreeCnf
|
|
|
291ba4 |
|
|
|
291ba4 |
/* open journal */
|