RDKB-64639 Fix resource leaks in cci process - #35
Open
skarth597 wants to merge 3 commits into
Open
Conversation
…eny CAC cases (rdkcentral#9) XB10-2061 Result string not available for preassoc and postassoc deny CAC cases Reason for change: To debug Test Procedure: 1. Flash the build image 2. Run the CCI test case CAC0009 3. Check for the pre deny string in /rdklogs/logs/wifiConnAdmissionCtrl Priority: P1 Risks: Low Signed-off-by: Samyuktha Karthikeyan <samyuktha_karthikeyan@comcast.com>
Impacted Platforms: TCXB7, TCXB8 Reason for change: Properly close the FD's before return Test Procedure: Run any cci test and check for the FD count before/after test Risks: None Priority: P1 Signed-off-by:Pavithra_Sundaravadivel@comcast.com
…tassoc deny CAC cases (rdkcentral#9)" This reverts commit fbe799b.
There was a problem hiding this comment.
Pull request overview
This PR targets file-descriptor/resource leak reduction in the CCI test execution path (notably around popen()/pcap usage) for impacted TCXB7/TCXB8 platforms.
Changes:
- Close output FILE/pipe handles on additional early-return paths in command/performance steps.
- Close
pcapdumper handles after writing/flush to avoid lingering open dump FDs. - Add additional cleanup during allocation failure handling in command execution.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/tests/wlan_emu_test_param_gateway_performance.cpp |
Adds missing fclose(out) on an abort path in performance logging. |
src/tests/wlan_emu_test_param_command.cpp |
Adds pclose()/fclose() cleanup on error paths in command execution. |
src/messages/wlan_emu_msg.cpp |
Closes pcap dumper handle after dumping/flushing packets. |
src/external_agent_cci/wlan_ext_emu_test_step_params.cpp |
Closes pcap dumper handle after dumping/flushing packets (external agent path). |
Comments suppressed due to low confidence (1)
src/tests/wlan_emu_test_param_command.cpp:71
fgets(buff, sizeof(buff), fp)usessizeof(buff)wherebuffis a pointer, so it will only read pointer-sized chunks (typically 8 bytes) instead of the allocated 4096 bytes. This truncates command output and can cause incorrect logging behavior.
return RETURN_ERR;
}
// Read and print the output of the cmd
while (fgets(buff, sizeof(buff), fp) != NULL) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
121
to
125
| } else { | ||
| fclose(out); | ||
| step->test_state = wlan_emu_tests_state_cmd_abort; | ||
| return NULL; | ||
| } |
Comment on lines
364
to
368
| pcap_dump((u_char *)dump_handle, &pkthdr, tmp_buff); | ||
| pcap_dump_flush(dump_handle); | ||
| pcap_dump_close(dump_handle); | ||
| pcap_close(handle); | ||
|
|
Comment on lines
209
to
213
| pcap_dump((u_char *)dump_handle, &pkthdr, tmp_buff); | ||
| pcap_dump_flush(dump_handle); | ||
| pcap_dump_close(dump_handle); | ||
| pcap_close(handle); | ||
|
|
Comment on lines
35
to
39
| wlan_emu_print(wlan_emu_log_level_err, "%s:%d: get_current_time_string failed\n", | ||
| __func__, __LINE__); | ||
| pclose(fp); | ||
| return RETURN_ERR; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Impacted Platforms:
TCXB7, TCXB8
Reason for change: Properly close the FD's before return
Test Procedure: Run any cci test and check for the FD count before/after test
Risks: None
Priority: P1
Signed-off-by:Pavithra_Sundaravadivel@comcast.com