Skip to content

Fix allocation cleanup in FreeDialogResult#980

Open
sage-mode-hunter wants to merge 1 commit into
microsoft:mainfrom
sage-mode-hunter:fix-freedialogresult-cleanup
Open

Fix allocation cleanup in FreeDialogResult#980
sage-mode-hunter wants to merge 1 commit into
microsoft:mainfrom
sage-mode-hunter:fix-freedialogresult-cleanup

Conversation

@sage-mode-hunter

@sage-mode-hunter sage-mode-hunter commented Jul 1, 2026

Copy link
Copy Markdown

This change corrects the cleanup logic in FreeDialogResult.

Replace delete[] with delete when destroying _AddInDialogResult, matching its allocation with scalar new.
Release the lpDialogControlResults array after freeing the dynamically allocated members it contains.

These changes make the allocation/deallocation pairs consistent and ensure the dialog result object is fully cleaned up.

@sage-mode-hunter

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree [company="BugQore"]

@sage-mode-hunter

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="BugQore"

Comment thread UI/addinui.cpp
Comment on lines 165 to +168
{
for (ULONG i = 0; i < lpDialogResult->ulNumControls; i++)
if (lpDialogResult->lpDialogControlResults)
{
delete[] lpDialogResult->lpDialogControlResults[i].lpBin;
delete[] lpDialogResult->lpDialogControlResults[i].szText;
for (ULONG i = 0; i < lpDialogResult->ulNumControls; i++)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you fix the indenting here? - it makes the change look much larger than it actually is

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think I can approve as soon as the indentation is fixed

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