Skip to content

Fix rdmaServer leaks when create listen cm id error#3557

Merged
enjoy-binbin merged 1 commit into
valkey-io:unstablefrom
enjoy-binbin:leak
Apr 27, 2026
Merged

Fix rdmaServer leaks when create listen cm id error#3557
enjoy-binbin merged 1 commit into
valkey-io:unstablefrom
enjoy-binbin:leak

Conversation

@enjoy-binbin

Copy link
Copy Markdown
Member

In here we should go to error to free the resources:

error:
    if (listen_cmid) rdma_destroy_id(listen_cmid);
    if (listen_channel) rdma_destroy_event_channel(listen_channel);
    ret = ANET_ERR;

end:
    freeaddrinfo(servinfo);
    return ret;
}

In here we should go to error to free the resources:
```
error:
    if (listen_cmid) rdma_destroy_id(listen_cmid);
    if (listen_channel) rdma_destroy_event_channel(listen_channel);
    ret = ANET_ERR;

end:
    freeaddrinfo(servinfo);
    return ret;
}
```

Signed-off-by: Binbin <binloveplay1314@qq.com>
@enjoy-binbin enjoy-binbin requested a review from pizhenwei April 24, 2026 03:34
@enjoy-binbin enjoy-binbin changed the title Fix rdmaServer leaks when when create listen cm id error Fix rdmaServer leaks when create listen cm id error Apr 24, 2026
@codecov

codecov Bot commented Apr 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.37%. Comparing base (d2db0c2) to head (be9cf3c).
⚠️ Report is 6 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #3557      +/-   ##
============================================
+ Coverage     76.35%   76.37%   +0.02%     
============================================
  Files           159      159              
  Lines         80054    80054              
============================================
+ Hits          61125    61145      +20     
+ Misses        18929    18909      -20     
Files with missing lines Coverage Δ
src/rdma.c 100.00% <ø> (ø)

... and 23 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pizhenwei pizhenwei left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@enjoy-binbin enjoy-binbin merged commit ac9ca9d into valkey-io:unstable Apr 27, 2026
59 checks passed
@enjoy-binbin enjoy-binbin deleted the leak branch April 27, 2026 03:01
sarthakaggarwal97 pushed a commit to sarthakaggarwal97/valkey that referenced this pull request Apr 27, 2026
In here we should go to error to free the resources:
```
error:
    if (listen_cmid) rdma_destroy_id(listen_cmid);
    if (listen_channel) rdma_destroy_event_channel(listen_channel);
    ret = ANET_ERR;

end:
    freeaddrinfo(servinfo);
    return ret;
}
```

Signed-off-by: Binbin <binloveplay1314@qq.com>
sarthakaggarwal97 added a commit to sarthakaggarwal97/valkey that referenced this pull request Apr 27, 2026
madolson pushed a commit that referenced this pull request Apr 27, 2026
In here we should go to error to free the resources:
```
error:
    if (listen_cmid) rdma_destroy_id(listen_cmid);
    if (listen_channel) rdma_destroy_event_channel(listen_channel);
    ret = ANET_ERR;

end:
    freeaddrinfo(servinfo);
    return ret;
}
```

Signed-off-by: Binbin <binloveplay1314@qq.com>
sarthakaggarwal97 added a commit to sarthakaggarwal97/valkey that referenced this pull request Apr 28, 2026
@zuiderkwast

Copy link
Copy Markdown
Contributor

Which release branches are affected? Backport?

@pizhenwei

Copy link
Copy Markdown
Contributor

Which release branches are affected? Backport?

This is introduced from the initial version, but it's very unlikely case in the real world, so I suggest to avoid the additional backport work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants