msg = (DBusMessage *)link->data;
rmsg = msg;
- _dbus_transport_assure_protocol_version (connection->transport, &rmsg);
-
- if (rmsg != msg) {
- _dbus_list_free_link(link);
- link = _dbus_list_alloc_link (rmsg);
- }
+ if (_dbus_transport_assure_protocol_version (connection->transport, &rmsg))
+ {
+ /* If the message is converted, then we don't need the old format anymore */
+ _dbus_list_free_link(link);
+ link = _dbus_list_alloc_link (rmsg);
+ dbus_message_unref (msg);
+ }
_dbus_list_append_link (&connection->incoming_messages, link);
dbus_message_lock (message);
/* This converts message if neccessary */
- _dbus_transport_assure_protocol_version (connection->transport, &message);
+ if (!_dbus_transport_assure_protocol_version (connection->transport, &message))
+ {
+ /* Only non-converted messages must be refed.
+ * Converted messages are local anyway.
+ */
+ dbus_message_ref (message);
+ }
preallocated->queue_link->data = message;
_dbus_list_prepend_link (&connection->outgoing_messages,
dbus_free (preallocated);
preallocated = NULL;
- dbus_message_ref (message);
-
connection->n_outgoing += 1;
_dbus_verbose ("Message %p (%s %s %s %s '%s') for %s added to outgoing queue %p, %d pending to send\n",
if (NULL != message->signature)
{
_dbus_string_free (message->signature);
+ dbus_free (message->signature);
message->signature = NULL;
}
if (NULL != message->unique_sender)
{
_dbus_string_free (message->unique_sender);
+ dbus_free (message->unique_sender);
message->unique_sender = NULL;
}
if (!_dbus_string_append_printf (message->unique_sender, ":1.%llu", (unsigned long long)unique_sender_id))
{
_dbus_string_free (message->unique_sender);
+ dbus_free (message->unique_sender);
message->unique_sender = NULL;
return FALSE;
}
if ((*message)->header.protocol_version != DBUS_MAJOR_PROTOCOL_VERSION)
{
*message = _dbus_message_remarshal (*message, FALSE);
+ return TRUE;
}
- return *message != NULL;
+ return FALSE;
}
dbus_bool_t
if ((*message)->header.protocol_version != DBUS_PROTOCOL_VERSION_GVARIANT)
{
*message = _dbus_message_remarshal (*message, TRUE);
+ return TRUE;
}
- return *message != NULL;
+ return FALSE;
}
/** @} */