summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/bitmap.c3
-rw-r--r--src/basic/fdset.c6
-rw-r--r--src/basic/lockfile-util.c3
-rw-r--r--src/basic/strv.c9
4 files changed, 9 insertions, 12 deletions
diff --git a/src/basic/bitmap.c b/src/basic/bitmap.c
index 7ea3357031..2eabf3e1c1 100644
--- a/src/basic/bitmap.c
+++ b/src/basic/bitmap.c
@@ -145,8 +145,7 @@ bool bitmap_isclear(Bitmap *b) {
void bitmap_clear(Bitmap *b) {
assert(b);
- free(b->bitmaps);
- b->bitmaps = NULL;
+ b->bitmaps = mfree(b->bitmaps);
b->n_bitmaps = 0;
b->bitmaps_allocated = 0;
}
diff --git a/src/basic/fdset.c b/src/basic/fdset.c
index a4823e6659..d70fe156a2 100644
--- a/src/basic/fdset.c
+++ b/src/basic/fdset.c
@@ -201,9 +201,11 @@ int fdset_cloexec(FDSet *fds, bool b) {
assert(fds);
- SET_FOREACH(p, MAKE_SET(fds), i)
- if ((r = fd_cloexec(PTR_TO_FD(p), b)) < 0)
+ SET_FOREACH(p, MAKE_SET(fds), i) {
+ r = fd_cloexec(PTR_TO_FD(p), b);
+ if (r < 0)
return r;
+ }
return 0;
}
diff --git a/src/basic/lockfile-util.c b/src/basic/lockfile-util.c
index 05e16d1caa..f3ec6a3e52 100644
--- a/src/basic/lockfile-util.c
+++ b/src/basic/lockfile-util.c
@@ -145,8 +145,7 @@ void release_lock_file(LockFile *f) {
if ((f->operation & ~LOCK_NB) == LOCK_EX)
unlink_noerrno(f->path);
- free(f->path);
- f->path = NULL;
+ f->path = mfree(f->path);
}
f->fd = safe_close(f->fd);
diff --git a/src/basic/strv.c b/src/basic/strv.c
index eaf440a4b2..b9aef64b15 100644
--- a/src/basic/strv.c
+++ b/src/basic/strv.c
@@ -270,10 +270,8 @@ char **strv_split_newlines(const char *s) {
if (n <= 0)
return l;
- if (isempty(l[n-1])) {
- free(l[n-1]);
- l[n-1] = NULL;
- }
+ if (isempty(l[n - 1]))
+ l[n - 1] = mfree(l[n - 1]);
return l;
}
@@ -292,9 +290,8 @@ int strv_split_extract(char ***t, const char *s, const char *separators, Extract
r = extract_first_word(&s, &word, separators, flags);
if (r < 0)
return r;
- if (r == 0) {
+ if (r == 0)
break;
- }
if (!GREEDY_REALLOC(l, allocated, n + 2))
return -ENOMEM;