Skip to content

[BUG] Arbitrated client token memory leakage #443

Open
@amgross

Description

Describe the bug

In ArbitratedClientManager::performClientRequest, in case of none oneway API token is aquired:

token = m_arbitrator->prepareClientReceive(request);

The token is released just as part of calling m_arbitrator->clientReceive(token), but this call is done just if codec status is OK:
if (request.getCodec()->isStatusOk() == true)
{
// Complete the receive through the arbitrator.
err = m_arbitrator->clientReceive(token);

Hence if m_arbitrator->send fails, the token won't get released:
err = m_arbitrator->send(&request.getCodec()->getBufferRef());
request.getCodec()->updateStatus(err);

To Reproduce

Loop calls of none oneway API on arbitrated client, where transport layer send fails.
You expect in first tomes to get the send fail, till memory leakege block your system and then the token getting will fail:

if (token == 0U)
{
request.getCodec()->updateStatus(kErpcStatus_Fail);
}

Expected behavior

Token is always released before exiting ArbitratedClientManager::performClientRequest

Screenshots

Desktop (please complete the following information)

  • OS: windows
  • eRPC Version:1.13.0

Steps you didn't forgot to do

  • I checked if there is no related issue opened/closed.
  • I checked that there doesn't exist opened PR which is solving this issue.

Additional context

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions