[systemd-commits] 4 commits - Makefile.am src/journal src/libsystemd-bus src/test

Lennart Poettering lennart at kemper.freedesktop.org
Tue Oct 8 19:09:21 PDT 2013


 Makefile.am                             |    5 +++++
 src/journal/journal-vacuum.c            |    2 ++
 src/journal/test-journal-interleaving.c |   29 ++++++++++++-----------------
 src/journal/test-journal.c              |    5 +++++
 src/libsystemd-bus/sd-bus.c             |    2 +-
 src/test/test-util.c                    |    2 +-
 6 files changed, 26 insertions(+), 19 deletions(-)

New commits:
commit 753eff037ee99d2c5ecbf3c3228c78d616cbb310
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Oct 9 04:04:10 2013 +0200

    bus: fix missing initialization

diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index 993c2e6..795007a 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -3639,7 +3639,7 @@ static int add_object_vtable_internal(
                 sd_bus_object_find_t find,
                 void *userdata) {
 
-        struct node_vtable *c, *i;
+        struct node_vtable *c = NULL, *i;
         const sd_bus_vtable *v;
         struct node *n;
         int r;

commit 510b857f7d1e7e8d38912890536342dd5dd647dd
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Oct 9 04:04:04 2013 +0200

    tests: fix some memory leaks in tests

diff --git a/src/journal/test-journal-interleaving.c b/src/journal/test-journal-interleaving.c
index 1a058ea..af0d43e 100644
--- a/src/journal/test-journal-interleaving.c
+++ b/src/journal/test-journal-interleaving.c
@@ -50,20 +50,17 @@ _noreturn_ static void log_assert_errno(const char *text, int eno, const char *f
                         log_assert_errno(#expr, -_r_, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
         } while (false)
 
-static JournalFile *test_open (const char *name)
-{
+static JournalFile *test_open(const char *name) {
         JournalFile *f;
         assert_ret(journal_file_open(name, O_RDWR|O_CREAT, 0644, true, false, NULL, NULL, NULL, &f));
         return f;
 }
 
-static void test_close (JournalFile *f)
-{
+static void test_close(JournalFile *f) {
         journal_file_close (f);
 }
 
-static void append_number(JournalFile *f, int n, uint64_t *seqnum)
-{
+static void append_number(JournalFile *f, int n, uint64_t *seqnum) {
         char *p;
         dual_timestamp ts;
         struct iovec iovec[1];
@@ -74,13 +71,12 @@ static void append_number(JournalFile *f, int n, uint64_t *seqnum)
         iovec[0].iov_base = p;
         iovec[0].iov_len = strlen(p);
         assert_ret(journal_file_append_entry(f, &ts, iovec, 1, seqnum, NULL, NULL));
-        free (p);
+        free(p);
 }
 
-static void test_check_number (sd_journal *j, int n)
-{
+static void test_check_number (sd_journal *j, int n) {
         const void *d;
-        char *k;
+        _cleanup_free_ char *k;
         size_t l;
         int x;
 
@@ -92,9 +88,10 @@ static void test_check_number (sd_journal *j, int n)
         assert_se(n == x);
 }
 
-static void test_check_numbers_down (sd_journal *j, int count)
-{
-        for (int i = 1; i <= count; i++) {
+static void test_check_numbers_down (sd_journal *j, int count) {
+        int i;
+
+        for (i = 1; i <= count; i++) {
                 int r;
                 test_check_number(j, i);
                 assert_ret(r = sd_journal_next(j));
@@ -106,8 +103,7 @@ static void test_check_numbers_down (sd_journal *j, int count)
 
 }
 
-static void test_check_numbers_up (sd_journal *j, int count)
-{
+static void test_check_numbers_up (sd_journal *j, int count) {
         for (int i = count; i >= 1; i--) {
                 int r;
                 test_check_number(j, i);
@@ -144,8 +140,7 @@ static void setup_interleaved(void) {
         test_close(two);
 }
 
-static void test_skip(void (*setup)(void))
-{
+static void test_skip(void (*setup)(void)) {
         char t[] = "/tmp/journal-skip-XXXXXX";
         sd_journal *j;
         int r;
diff --git a/src/journal/test-journal.c b/src/journal/test-journal.c
index 190c426..189fe07 100644
--- a/src/journal/test-journal.c
+++ b/src/journal/test-journal.c
@@ -169,6 +169,11 @@ static void test_empty(void) {
 
                 assert_se(rm_rf_dangerous(t, false, true, false) >= 0);
         }
+
+        journal_file_close(f1);
+        journal_file_close(f2);
+        journal_file_close(f3);
+        journal_file_close(f4);
 }
 
 int main(int argc, char *argv[]) {
diff --git a/src/test/test-util.c b/src/test/test-util.c
index c5762ed..7fd0572 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -587,7 +587,7 @@ static void test_get_files_in_directory(void) {
         _cleanup_strv_free_ char **l = NULL, **t = NULL;
 
         assert_se(get_files_in_directory("/tmp", &l) >= 0);
-        assert_se(get_files_in_directory(".", &l) >= 0);
+        assert_se(get_files_in_directory(".", &t) >= 0);
         assert_se(get_files_in_directory(".", NULL) >= 0);
 }
 

commit 2ee0591d12b9e725c4585502285fd91cde682d9b
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Oct 9 04:03:45 2013 +0200

    journald: fix minor memory leak

diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
index c73ad8f..8d5effb 100644
--- a/src/journal/journal-vacuum.c
+++ b/src/journal/journal-vacuum.c
@@ -278,6 +278,8 @@ int journal_directory_vacuum(
                         } else if (errno != ENOENT)
                                 log_warning("Failed to delete %s/%s: %m", directory, p);
 
+                        free(p);
+
                         continue;
                 }
 

commit cac914e643a50c72893c5478f6886e0978f8fa18
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Oct 9 04:02:54 2013 +0200

    build-sys: add a makefile target to run all tests through valgrind

diff --git a/Makefile.am b/Makefile.am
index 49e41ec..31dde6f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4588,3 +4588,8 @@ install-tree: all
 	rm -rf $(abs_srcdir)/install-tree
 	$(MAKE) install DESTDIR=$(abs_srcdir)/install-tree
 	tree $(abs_srcdir)/install-tree
+
+# Let's run all tests of the test suite, but under valgrind. Let's
+# exclude the one perl script we have in there
+valgrind-tests: $(TESTS)
+	for f in $(TESTS) ; do [ "$$f" == "$${f/.pl/}" ] && libtool --mode=execute valgrind --leak-check=full --error-exitcode=55 $(builddir)/$$f ; done



More information about the systemd-commits mailing list