Jim Meyering wrote:
* lib/ipc_us.c (handle_new_connection): Remove unnecessary
initialization of "c".
Don't leak a "struct qb_ipcs_connection" upon successful return.
---
Hi,
coverity spotted this leak.
Here's a fix (that also removes the unneeded init).
lib/ipc_us.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/ipc_us.c b/lib/ipc_us.c
index e21f25d..1ba86e9 100644
--- a/lib/ipc_us.c
+++ b/lib/ipc_us.c
@@ -505,7 +505,7 @@ static int32_t handle_new_connection(struct qb_ipcs_service *s,
void *msg, size_t len,
struct ipc_auth_ugp *ugp)
{
- struct qb_ipcs_connection *c = NULL;
+ struct qb_ipcs_connection *c;
struct qb_ipc_connection_request *req = msg;
int32_t res = auth_result;
struct qb_ipc_connection_response response;
@@ -604,6 +604,7 @@ send_response:
}
qb_ipcs_disconnect(c);
}
+ free(c);
return res;
}
I realized belatedly that this change induces a failure
(at least on F15) in the ipc test.
Looking more closely I see that coverity is failing to
see that qb_ipcs_connection_unref *may* free that buffer.
So please disregard this patch. At least the free-adding part.