tree-wide: use coccinelle to patch a lot of code to use mfree()
This replaces this:
free(p);
p = NULL;
by this:
p = mfree(p);
Change generated using coccinelle. Semantic patch is added to the
sources.
This commit is contained in:
+1
-2
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
+1
-2
@@ -271,8 +271,7 @@ char **strv_split_newlines(const char *s) {
|
||||
return l;
|
||||
|
||||
if (isempty(l[n-1])) {
|
||||
free(l[n-1]);
|
||||
l[n-1] = NULL;
|
||||
l[n - 1] = mfree(l[n - 1]);
|
||||
}
|
||||
|
||||
return l;
|
||||
|
||||
Reference in New Issue
Block a user