On 8/20/25 06:27, Daniel P. Berrangé wrote:
+char *qmessage_context(int flags)
+{
+    g_autofree char *timestr = NULL;
+
+    if ((flags & QMESSAGE_CONTEXT_SKIP_MONITOR) &&
+        monitor_cur()) {
+        return g_strdup("");

In the event we want no context, we really should avoid memory allocation too.


+    }
+
+    if (message_format & QMESSAGE_FORMAT_TIMESTAMP) {
+        g_autoptr(GDateTime) dt = g_date_time_new_now_utc();
+        timestr = g_date_time_format_iso8601(dt);
+    }
+
+    return g_strdup_printf("%s%s",
+                           timestr ? timestr : "",
+                           timestr ? " " : "");

g_strdup_printf isn't the nicest string concatenation tool.
And again, there's a no-context path.


r~

Reply via email to