Skip to content

fix: SM50 error-object leak/null-deref + fence QI-failure leak (clang-tidy) - #197

Closed
cyyever wants to merge 2 commits into
3Shain:mainfrom
cyyever:fix/airconv-error-leaks
Closed

fix: SM50 error-object leak/null-deref + fence QI-failure leak (clang-tidy)#197
cyyever wants to merge 2 commits into
3Shain:mainfrom
cyyever:fix/airconv-error-leaks

Conversation

@cyyever

@cyyever cyyever commented Jul 25, 2026

Copy link
Copy Markdown

Three memory-safety fixes surfaced by a clang-tidy (clang-analyzer) sweep:

  • airconv/dxbc_converter.cppSM50ErrorInternal leaked on every successful compile. The six SM50* entry points new'd an error object at entry but only returned it via *ppError on error paths, so it (and its LLVM buffer) leaked on success. Now held in a std::unique_ptr, released to the caller only on error.
  • Same file — null *ppError write. SM50Initialize treats ppError == NULL as legal (if (ppError) *ppError = nullptr;) but the error paths then wrote *ppError unconditionally, crashing such callers. All error paths now go through a set_error() helper that no-ops when ppError is null.
  • d3d11/d3d11_fence.cpp — fence leaked on QueryInterface failure. CreateFence/OpenSharedFence new'd the impl (refcount 0) then returned QueryInterface(...); a QI failure orphaned it. Now held in Com<> via ref().

Each changed TU compiles clean.

@3Shain

3Shain commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Please sign off your commits (assuming works are done by human)

@cyyever
cyyever force-pushed the fix/airconv-error-leaks branch 8 times, most recently from abdd36b to ccd2d75 Compare July 26, 2026 00:42
@cyyever

cyyever commented Jul 26, 2026

Copy link
Copy Markdown
Author

@3Shain Signed

@3Shain

3Shain commented Jul 26, 2026

Copy link
Copy Markdown
Owner

@3Shain Signed

Is it possible to use a real name?

@cyyever
cyyever force-pushed the fix/airconv-error-leaks branch from ccd2d75 to 62eff4f Compare July 26, 2026 01:14
@cyyever

cyyever commented Jul 26, 2026

Copy link
Copy Markdown
Author

@3Shain Sure, I have resigned.

@3Shain

3Shain commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Format your commit message and split into two by scope

cyyever added 2 commits July 26, 2026 15:08
Signed-off-by: Yuanyuan Chen <cyyever@outlook.com>
Signed-off-by: Yuanyuan Chen <cyyever@outlook.com>
@cyyever
cyyever force-pushed the fix/airconv-error-leaks branch from 62eff4f to afb3c12 Compare July 26, 2026 07:09
@cyyever

cyyever commented Jul 27, 2026

Copy link
Copy Markdown
Author

fixed

@3Shain

3Shain commented Jul 27, 2026

Copy link
Copy Markdown
Owner

fixed

Have you ever checked existing commit messages on main branch...

It should start with fix(scope):

@cyyever cyyever closed this Jul 27, 2026
@cyyever
cyyever deleted the fix/airconv-error-leaks branch July 27, 2026 07:59
@3Shain

3Shain commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Why closed? Anyway thanks for spotting the leaks.

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