logging: Unregister osmo_fd before closing fd

Change-Id: I0754ac3110b63d2a380068010830af6c85b0a653
This commit is contained in:
Pau Espin 2023-03-09 17:50:38 +01:00 committed by pespin
parent 8d1532af92
commit 040548f790
1 changed files with 1 additions and 1 deletions

View File

@ -1327,12 +1327,12 @@ void log_target_destroy(struct log_target *target)
} }
wq = target->tgt_file.wqueue; wq = target->tgt_file.wqueue;
if (wq) { if (wq) {
osmo_fd_unregister(&wq->bfd);
if (wq->bfd.fd >= 0) { if (wq->bfd.fd >= 0) {
if (target->type == LOG_TGT_TYPE_FILE) if (target->type == LOG_TGT_TYPE_FILE)
close(wq->bfd.fd); close(wq->bfd.fd);
wq->bfd.fd = -1; wq->bfd.fd = -1;
} }
osmo_fd_unregister(&wq->bfd);
osmo_wqueue_clear(wq); osmo_wqueue_clear(wq);
talloc_free(wq); talloc_free(wq);
target->tgt_file.wqueue = NULL; target->tgt_file.wqueue = NULL;