pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/41975?usp=email )
Change subject: logging_file: Fix log_target_file_switch_to_stream on stderr ......................................................................
logging_file: Fix log_target_file_switch_to_stream on stderr
In stderr log target, the bfd of the wq was left registered despite freeing the wq, which ended up in the callback being called and the freed wq being used.
Change-Id: I1c0d833fb8ae82d1dd54e44cc2fc8be80d5e1b4b --- M src/core/logging_file.c 1 file changed, 3 insertions(+), 4 deletions(-)
Approvals: fixeria: Looks good to me, approved osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/src/core/logging_file.c b/src/core/logging_file.c index 6e01c26..99a797c 100644 --- a/src/core/logging_file.c +++ b/src/core/logging_file.c @@ -213,11 +213,10 @@ }
/* now that everything succeeded, we can finally close the old output fd */ - if (target->type == LOG_TGT_TYPE_FILE) { - osmo_fd_unregister(&wq->bfd); + osmo_fd_unregister(&wq->bfd); + if (target->type == LOG_TGT_TYPE_FILE) close(wq->bfd.fd); - wq->bfd.fd = -1; - } + wq->bfd.fd = -1;
/* release the queue itself */ talloc_free(wq);