[systemd-commits] 2 commits - man/sd_journal_open.xml src/modules-load
Zbigniew JÄdrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Tue Dec 4 05:04:55 PST 2012
man/sd_journal_open.xml | 2 +-
src/modules-load/modules-load.c | 23 ++++++++---------------
2 files changed, 9 insertions(+), 16 deletions(-)
New commits:
commit 486aad23f0d07c6dd688dcfce2ca3fdbf9fc25bd
Author: Philip Nilsson <pnilsson at nullref.se>
Date: Mon Dec 3 18:26:52 2012 +0100
man: correct documented return type for sd_journal_close
diff --git a/man/sd_journal_open.xml b/man/sd_journal_open.xml
index 06d0ccf..76b857b 100644
--- a/man/sd_journal_open.xml
+++ b/man/sd_journal_open.xml
@@ -71,7 +71,7 @@
</funcprototype>
<funcprototype>
- <funcdef>int <function>sd_journal_close</function></funcdef>
+ <funcdef>void <function>sd_journal_close</function></funcdef>
<paramdef>sd_journal* <parameter>j</parameter></paramdef>
</funcprototype>
</funcsynopsis>
commit c007bb1b4d1366130f69dfbde53124211307a31a
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Tue Dec 4 13:57:53 2012 +0100
modules-load: fix memory leak when bailing out
Suggested-by: Mauro Dreissig <mukadr at gmail.com>
diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c
index e72e382..f6279e1 100644
--- a/src/modules-load/modules-load.c
+++ b/src/modules-load/modules-load.c
@@ -64,7 +64,8 @@ static int add_modules(const char *p) {
}
static int parse_proc_cmdline(void) {
- char *line, *w, *state;
+ char _cleanup_free_ *line = NULL;
+ char *w, *state;
int r;
size_t l;
@@ -78,38 +79,30 @@ static int parse_proc_cmdline(void) {
}
FOREACH_WORD_QUOTED(w, l, line, state) {
- char *word;
+ char _cleanup_free_ *word;
word = strndup(w, l);
- if (!word) {
- r = -ENOMEM;
- goto finish;
- }
+ if (!word)
+ return log_oom();
if (startswith(word, "modules-load=")) {
r = add_modules(word + 13);
if (r < 0)
- goto finish;
+ return r;
} else if (startswith(word, "rd.modules-load=")) {
if (in_initrd()) {
r = add_modules(word + 16);
if (r < 0)
- goto finish;
+ return r;
}
}
-
- free(word);
}
- r = 0;
-
-finish:
- free(line);
- return r;
+ return 0;
}
static int load_module(struct kmod_ctx *ctx, const char *m) {
More information about the systemd-commits
mailing list