[PATCH 2/2] connection: set initial count when extending counter array

John de la Garza <[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Message-ID <[email protected]>
Signed-off-by: John de la Garza <[email protected]>
---
 connection.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/connection.c b/connection.c
index ec121d6..c1686c7 100644
--- a/connection.c
+++ b/connection.c
@@ -185,6 +185,7 @@ static int kdbus_conn_queue_user_quota(struct kdbus_conn *conn,
 	if (user >= conn->msg_users_max) {
 		unsigned int *users;
 		unsigned int i;
+		struct kdbus_queue_entry *e;
 
 		i = 8 + KDBUS_ALIGN8(user);
 		users = kcalloc(i, sizeof(unsigned int), GFP_KERNEL);
@@ -196,6 +197,10 @@ static int kdbus_conn_queue_user_quota(struct kdbus_conn *conn,
 		kfree(conn->msg_users);
 		conn->msg_users = users;
 		conn->msg_users_max = i;
+		list_for_each_entry(e, &conn->queue.msg_list, entry) {
+			conn->msg_users[user]++;
+		}
+
 	}
 
 	if (conn->msg_users[user] > KDBUS_CONN_MAX_MSGS_PER_USER)
-- 
2.1.1

_______________________________________________
dbus mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dbus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.