[PATCH] android/avctp: Fix reference counting

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

 



Drop extra reference before exiting function.
---
 android/avctp.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/android/avctp.c b/android/avctp.c
index d1d2f95..c92bb54 100644
--- a/android/avctp.c
+++ b/android/avctp.c
@@ -787,8 +787,10 @@ static void control_response(struct avctp_channel *control,
 		if (req->func && req->func(control->session, avc->code,
 						avc->subunit_type,
 						operands, operand_count,
-						req->user_data))
+						req->user_data)) {
+			avctp_unref(control->session);
 			return;
+		}
 
 		control->processed = g_slist_remove(control->processed, p);
 		pending_destroy(p, NULL);
@@ -833,12 +835,17 @@ static void browsing_response(struct avctp_channel *browsing,
 		avctp_ref(browsing->session);
 
 		if (req->func && req->func(browsing->session, operands,
-						operand_count, req->user_data))
+							operand_count,
+							req->user_data)) {
+			avctp_unref(browsing->session);
 			return;
+		}
 
 		browsing->processed = g_slist_remove(browsing->processed, p);
 		pending_destroy(p, NULL);
 
+		avctp_unref(browsing->session);
+
 		return;
 	}
 }
-- 
1.9.3

--
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