Skip to content

test commit for High level issues#111

Closed
Sid2001-maker wants to merge 1 commit into
developfrom
temp/RDKEMW-12252
Closed

test commit for High level issues#111
Sid2001-maker wants to merge 1 commit into
developfrom
temp/RDKEMW-12252

Conversation

@Sid2001-maker
Copy link
Copy Markdown
Contributor

No description provided.

@Sid2001-maker Sid2001-maker requested a review from a team as a code owner February 4, 2026 09:15
Copilot AI review requested due to automatic review settings February 4, 2026 09:15
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 4, 2026


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@Sid2001-maker Sid2001-maker changed the title test commit don't merge test commit for High level issues Feb 4, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 contains various bug fixes and improvements including memory leak fixes, variable initialization, and proper destructor implementation. Despite being marked as a "test commit," the changes appear to address legitimate issues in the codebase.

Changes:

  • Fixed multiple memory leaks in JavaScriptUtils.cpp and JavaScriptContext.cpp
  • Added missing variable initialization and declaration in JSRuntimeServer.cpp and NativeJSRenderer.cpp
  • Added virtual destructor to IJavaScriptContext interface following C++ best practices

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/jsc/JavaScriptUtils.cpp Added free(buffer) to prevent memory leak and delete netMetricsArray on error path
src/jsc/JavaScriptContext.cpp Added cleanup for mNetworkMetricsData in destructor to prevent memory leak
src/NativeJSRenderer.cpp Added missing id variable declaration and fixed indentation
src/JSRuntimeServer.cpp Initialized res variable to 0 to prevent use of uninitialized variable
include/IJavaScriptContext.h Added virtual destructor to interface class with virtual methods

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

class IJavaScriptContext
{
public:
virtual ~IJavaScriptContext() = default;
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The PR title "test commit don't merge" indicates this PR is not intended for merging. This appears to be a test or work-in-progress PR that should be closed or converted to draft.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +697 to 698
delete netMetricsArray;
return RT_FAIL;
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

Memory leak: netMetricsArray is allocated before this point (line 692) but may be leaked if subsequent error paths at lines 704-706 or 718-720 return early without cleanup. While this fix addresses one leak on line 697, there are other early return paths (lines 704-706 and 718-720) that still need similar cleanup to avoid memory leaks.

Copilot uses AI. Check for mistakes.
Comment thread src/NativeJSRenderer.cpp
uint32_t id = createApplicationIdentifier();
settings.enableJSDOM = mEnableTestFileDOMSupport;
ApplicationRequest appRequest(id, RUN, mTestFileName, settings.enableHttp, settings.enableXHR, settings.enableWebSocket, settings.enableWebSocketEnhanced, settings.enableFetch, settings.enableJSDOM, settings.enableWindow, settings.enablePlayer);
ApplicationRequest appRequest(id, RUN, mTestFileName, settings.enableHttp, settings.enableXHR, settings.enableWebSocket, settings.enableWebSocketEnhanced, settings.enableFetch, settings.enableJSDOM, settings.enableWindow, settings.enablePlayer);
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

Inconsistent indentation: This line now uses spaces while the surrounding lines (510, 512) use tabs. The indentation should be consistent throughout the file. The original version used tabs, which was consistent with the surrounding code.

Suggested change
ApplicationRequest appRequest(id, RUN, mTestFileName, settings.enableHttp, settings.enableXHR, settings.enableWebSocket, settings.enableWebSocketEnhanced, settings.enableFetch, settings.enableJSDOM, settings.enableWindow, settings.enablePlayer);
ApplicationRequest appRequest(id, RUN, mTestFileName, settings.enableHttp, settings.enableXHR, settings.enableWebSocket, settings.enableWebSocketEnhanced, settings.enableFetch, settings.enableJSDOM, settings.enableWindow, settings.enablePlayer);

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +335 to 336
free(buffer);
return RT_OK;
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The free(buffer) call will not be reached if result is null and the early return path at line 336 is taken. Additionally, there are multiple error conditions (fopen failure, stat failure, malloc failure, fread failure) that are not checked, which could lead to undefined behavior or crashes. The function needs comprehensive error handling with proper cleanup on all paths.

Copilot uses AI. Check for mistakes.
Comment thread src/NativeJSRenderer.cpp
if(!mTestFileName.empty())
{
ModuleSettings settings;
uint32_t id = createApplicationIdentifier();
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

Variable shadowing detected: the local variable 'id' declared on line 509 shadows the outer scope variable 'id' declared at line 471. This can lead to confusion and potential bugs. Consider renaming one of these variables to avoid shadowing.

Copilot uses AI. Check for mistakes.
Comment on lines +335 to 336
free(buffer);
return RT_OK;
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The function parameters (numArgs, args, context) are declared but never used. This suggests the function is incomplete or the parameters should be used for validation and file path specification. Consider adding UNUSED_PARAM macros for genuinely unused parameters or implementing proper parameter handling.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 315 to 337
rtError rtReadBinaryBinding(int numArgs, const rtValue* args, rtValue* result, void* context)
{
char *buffer = nullptr;
FILE *ptr = nullptr;
ptr = fopen("hello.wasm","rb"); // r for read, b for binary

const char *fd = "hello.wasm";
struct stat buf;

stat(fd, &buf);
int size = buf.st_size;

buffer = (char*)malloc(size);
fread(buffer,size,1,ptr); // read 10 bytes to our buffer
fclose(ptr);

if (result)
{
result->setString(buffer);
}
free(buffer);
return RT_OK;
}
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The rtReadBinaryBinding function has multiple error handling issues that can lead to crashes or memory leaks:

  1. If fopen fails (line 319), ptr will be NULL, but the code continues to call stat, malloc, fread, and fclose without checking
  2. If stat fails (line 324), buf.st_size will be undefined
  3. If malloc fails (line 327), buffer will be NULL, but fread and setString will be called with it
  4. fclose is called with a potentially NULL ptr

These error paths need to be checked and handled properly. For each operation that can fail, add proper error checking and cleanup. For example:

  • Check if ptr is NULL after fopen
  • Check if stat returns -1
  • Check if buffer is NULL after malloc
  • Only call fclose if ptr is not NULL

Also consider using fseek/ftell or maintaining proper error handling throughout the function to ensure resources are cleaned up on all paths.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Sid2001-maker Sid2001-maker deleted the temp/RDKEMW-12252 branch February 4, 2026 11:13
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants