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
diff --git a/src/logging.c b/src/logging.c
index 9e2f5c2..b6c26d2 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -992,7 +992,10 @@
 	}
 	/* 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