mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-24 21:34:08 +03:00
journal-remote: fix memory leak on initialization error
Follow-up for f12b399dd6
from
https://github.com/systemd/systemd/pull/25076
CID#1501550
This commit is contained in:
parent
a4f82d2cd7
commit
4bf277caa5
@ -22,7 +22,7 @@ static int do_rotate(ManagedJournalFile **f, MMapCache *m, JournalFileFlags file
|
|||||||
}
|
}
|
||||||
|
|
||||||
Writer* writer_new(RemoteServer *server) {
|
Writer* writer_new(RemoteServer *server) {
|
||||||
Writer *w;
|
_cleanup_(writer_unrefp) Writer *w = NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
w = new0(Writer, 1);
|
w = new0(Writer, 1);
|
||||||
@ -33,7 +33,7 @@ Writer* writer_new(RemoteServer *server) {
|
|||||||
|
|
||||||
w->mmap = mmap_cache_new();
|
w->mmap = mmap_cache_new();
|
||||||
if (!w->mmap)
|
if (!w->mmap)
|
||||||
return mfree(w);
|
return NULL;
|
||||||
|
|
||||||
w->n_ref = 1;
|
w->n_ref = 1;
|
||||||
w->server = server;
|
w->server = server;
|
||||||
@ -50,7 +50,7 @@ Writer* writer_new(RemoteServer *server) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return w;
|
return TAKE_PTR(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Writer* writer_free(Writer *w) {
|
static Writer* writer_free(Writer *w) {
|
||||||
|
Loading…
Reference in New Issue
Block a user