[systemd-commits] 2 commits - src/activate src/test
David Herrmann
dvdhrm at kemper.freedesktop.org
Thu Sep 11 08:51:26 PDT 2014
src/activate/activate.c | 2 +-
src/test/test-util.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
New commits:
commit aa44499da15a8fa7026463555a7a27e55e4e24a8
Author: Philippe De Swert <philippedeswert at gmail.com>
Date: Wed Sep 10 22:14:41 2014 +0300
activate: fix fd leak in do_accept()
Found with Coverity.
diff --git a/src/activate/activate.c b/src/activate/activate.c
index 8942773..0a1df37 100644
--- a/src/activate/activate.c
+++ b/src/activate/activate.c
@@ -242,7 +242,7 @@ static int launch1(const char* child, char** argv, char **env, int fd) {
static int do_accept(const char* name, char **argv, char **envp, int fd) {
_cleanup_free_ char *local = NULL, *peer = NULL;
- int fd2;
+ _cleanup_close_ int fd2 = -1;
fd2 = accept(fd, NULL, NULL);
if (fd2 < 0) {
commit 3f2e132a197ba3f5172cbbcd285e9aab021de8fc
Author: David Herrmann <dh.herrmann at gmail.com>
Date: Thu Sep 11 17:37:30 2014 +0200
test: fix mem-leak in fdopen() test
We must free FILE* after function return to not leak resources. Note that
this also closes our fd as fdopen() takes ownership of it.
Reported by Philippe De Swert (via coverity).
diff --git a/src/test/test-util.c b/src/test/test-util.c
index 72a8a6b..80425ca 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -918,11 +918,11 @@ static void test_readlink_and_make_absolute(void) {
}
static void test_read_one_char(void) {
+ _cleanup_fclose_ FILE *file = NULL;
char r;
bool need_nl;
char name[] = "/tmp/test-read_one_char.XXXXXX";
- _cleanup_close_ int fd = -1;
- FILE *file;
+ int fd;
fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
assert_se(fd >= 0);
More information about the systemd-commits
mailing list