journal: make mmap_cache_unref() a NOP when NULL is passed, like all other destructors

This commit is contained in:
Lennart Poettering 2015-12-10 11:25:14 +01:00
parent 9eae2bf318
commit f649045c10
2 changed files with 5 additions and 3 deletions

View file

@ -169,8 +169,7 @@ JournalFile* journal_file_close(JournalFile *f) {
safe_close(f->fd);
free(f->path);
if (f->mmap)
mmap_cache_unref(f->mmap);
mmap_cache_unref(f->mmap);
ordered_hashmap_free_free(f->chain_cache);

View file

@ -348,7 +348,10 @@ static void mmap_cache_free(MMapCache *m) {
}
MMapCache* mmap_cache_unref(MMapCache *m) {
assert(m);
if (!m)
return NULL;
assert(m->n_ref > 0);
m->n_ref --;