From 6d1f724ca720ed22e338261714ee8188ecd17c70 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Thu, 8 Jan 2015 19:58:31 +0100 Subject: [PATCH] connection: add extra ref to reply while operating on it kdbus_reply_unlink() potentially destroys the reply, so keep an extra reference while working with it. Drop the reference after we're done. Signed-off-by: Daniel Mack --- connection.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/connection.c b/connection.c index 19a41dc..87f90b3 100644 --- a/connection.c +++ b/connection.c @@ -150,7 +150,7 @@ int kdbus_cmd_msg_recv(struct kdbus_conn *conn, /* just drop the message */ if (recv->flags & KDBUS_RECV_DROP) { - struct kdbus_reply *reply = entry->reply; + struct kdbus_reply *reply = kdbus_reply_ref(entry->reply); kdbus_queue_entry_remove(conn, entry); kdbus_pool_slice_release(entry->slice); @@ -178,6 +178,7 @@ int kdbus_cmd_msg_recv(struct kdbus_conn *conn, kdbus_notify_flush(conn->ep->bus); kdbus_queue_entry_free(entry); + kdbus_reply_unref(reply); return 0; } -- 2.34.1