mirror of https://gerrit.osmocom.org/libosmocore
logging: Fix memory leak in case async log write queue overflows
In case osmo_wqueue_enqueue_quiet() fails, msgb ownership is not transferred to the queue, but the caller is responsible for freeing the message buffer that we just failed to enqueue. Change-Id: I6306e34dc7289864c889e72adf31d74d4581a810 Closes: OS#5328 Related: OS#5329
This commit is contained in:
parent
43b0cbe282
commit
9a9627ec36
|
@ -992,7 +992,10 @@ static void _file_raw_output(struct log_target *target, int subsys, unsigned int
|
|||
}
|
||||
/* if we reach here, either we already had elements in the write_queue, or the synchronous write
|
||||
* failed: enqueue the message to the write_queue (backlog) */
|
||||
osmo_wqueue_enqueue_quiet(target->tgt_file.wqueue, msg);
|
||||
if (osmo_wqueue_enqueue_quiet(target->tgt_file.wqueue, msg) < 0) {
|
||||
msgb_free(msg);
|
||||
/* TODO: increment some counter so we can see that messages were dropped */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue