[PATCH BlueZ v0 3/4] gstavdtpsink: Free the D-Bus error on reply failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If D-Bus error is set we should free it.
---
I'm not sure whether we can split the error message or not.

 audio/gstavdtpsink.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/audio/gstavdtpsink.c b/audio/gstavdtpsink.c
index ffaed7f..3427043 100644
--- a/audio/gstavdtpsink.c
+++ b/audio/gstavdtpsink.c
@@ -786,13 +786,22 @@ static gboolean gst_avdtp_sink_transport_get_properties(GstAvdtpSink *self)
 	msg = dbus_message_new_method_call("org.bluez", self->transport,
 						"org.bluez.MediaTransport",
 						"GetProperties");
+	if (!msg) {
+		GST_ERROR_OBJECT(self, "D-Bus Memory allocation failed");
+		return FALSE;
+	}
+
 	reply = dbus_connection_send_with_reply_and_block(self->data->conn,
 							msg, -1, &err);
+	dbus_message_unref(msg);
 
-	if (dbus_error_is_set(&err) || reply == NULL) {
-		GST_ERROR_OBJECT(self, "Failed to get transport properties: %s",
-					err.message);
-		goto fail;
+	if (!reply) {
+		if (dbus_error_is_set(&err)) {
+			GST_ERROR_OBJECT(self, "Failed to get transport "
+						"properties: %s", err.message);
+			dbus_error_free(&err);
+		}
+		return FALSE;
 	}
 
 	if (!dbus_message_iter_init(reply, &arg_i)) {
@@ -824,7 +833,6 @@ static gboolean gst_avdtp_sink_transport_get_properties(GstAvdtpSink *self)
 	return gst_avdtp_sink_update_caps(self);
 
 fail:
-	dbus_message_unref(msg);
 	dbus_message_unref(reply);
 	return FALSE;
 
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux