[PATCH 2/2] shared/queue: Fix NULL data handling in queue_remove_all

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

 



queue_remove_if returns data so we must check entries count to detect
if entry was removed (with NULL data) or not found.
---
 src/shared/queue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/shared/queue.c b/src/shared/queue.c
index d94b34d..3507ed1 100644
--- a/src/shared/queue.c
+++ b/src/shared/queue.c
@@ -362,9 +362,10 @@ unsigned int queue_remove_all(struct queue *queue, queue_match_func_t function,
 	if (function) {
 		while (entry) {
 			void *data;
+			unsigned int entries = queue->entries;
 
 			data = queue_remove_if(queue, function, user_data);
-			if (!data)
+			if (entries == queue->entries)
 				break;
 
 			if (destroy)
-- 
1.9.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