summaryrefslogtreecommitdiff
path: root/src/journal/coredumpctl.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-17 23:36:25 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-18 19:49:30 -0400
commit763c7aa288485cf5ab627fe1d25ff58e76f9dacb (patch)
tree563130863f8763af93df272c0122c76ef25aaba0 /src/journal/coredumpctl.c
parenta50d7d4389217c0d3b527ee260eabf89e4a76caa (diff)
journal,shared: add _cleanup_journal_close_
Diffstat (limited to 'src/journal/coredumpctl.c')
-rw-r--r--src/journal/coredumpctl.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
index 8bfab0075f..99ca269327 100644
--- a/src/journal/coredumpctl.c
+++ b/src/journal/coredumpctl.c
@@ -34,6 +34,7 @@
#include "log.h"
#include "path-util.h"
#include "pager.h"
+#include "macro.h"
static enum {
ACTION_NONE,
@@ -42,7 +43,6 @@ static enum {
ACTION_GDB,
} arg_action = ACTION_LIST;
-static Set *matches = NULL;
static FILE* output = NULL;
static char* field = NULL;
@@ -139,7 +139,7 @@ fail:
return r;
}
-static int parse_argv(int argc, char *argv[]) {
+static int parse_argv(int argc, char *argv[], Set *matches) {
enum {
ARG_VERSION = 0x100,
ARG_NO_PAGER,
@@ -519,10 +519,11 @@ finish:
}
int main(int argc, char *argv[]) {
- sd_journal *j = NULL;
+ sd_journal _cleanup_journal_close_ *j = NULL;
const char* match;
Iterator it;
int r = 0;
+ Set _cleanup_set_free_free_ *matches = NULL;
setlocale(LC_ALL, "");
log_parse_environment();
@@ -534,7 +535,7 @@ int main(int argc, char *argv[]) {
goto end;
}
- r = parse_argv(argc, argv);
+ r = parse_argv(argc, argv, matches);
if (r < 0)
goto end;
@@ -578,11 +579,6 @@ int main(int argc, char *argv[]) {
}
end:
- if (j)
- sd_journal_close(j);
-
- set_free_free(matches);
-
pager_close();
if (output)