Skip to content

RDKB-64639 Fix resource leaks in cci process - #35

Open
skarth597 wants to merge 3 commits into
rdkcentral:mainfrom
skarth597:RDKB-64639
Open

RDKB-64639 Fix resource leaks in cci process#35
skarth597 wants to merge 3 commits into
rdkcentral:mainfrom
skarth597:RDKB-64639

Conversation

@skarth597

Copy link
Copy Markdown
Contributor

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

…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
Copilot AI review requested due to automatic review settings June 29, 2026 10:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 pcap dumper 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) uses sizeof(buff) where buff is 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;
}
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.

2 participants