Fix static analysis issues found by cppcheck#8
Merged
Conversation
- archive.c: Fix uninitialized variable 'rc' when compression is requested but HAVE_LIBZ is not defined. Add proper error handling for this case. - data.c: Fix resource leaks in validate_file_pages() by adding fclose(in) before all early return statements. - file.c: Replace unsafe realloc() calls with pgut_realloc() which properly handles allocation failures and prevents memory leaks. - validate.c: Remove dead stores to base_full_backup variable and initialize it to NULL to avoid uninitialized variable warnings. - lint.yml: Add --suppress=unknownMacro to cppcheck to suppress false positives on PostgreSQL format macros (UINT64_FORMAT, INT64_FORMAT, pg_attribute_printf).
Clang Static Analyzer produces too many false positive warnings: - Cannot track NULL checks across function calls - Reports issues in PostgreSQL symlinked files (xlogreader.c, receivelog.c) - No simple way to suppress individual warnings inline cppcheck provides sufficient static analysis coverage for C code with better configurability and fewer false positives.
Add append-timestamp: false to ccache-action configuration. Without this, each CI run creates a new cache with a timestamp suffix, leading to dozens of duplicate caches (~60MB each) instead of reusing the existing one.
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.
Summary
rcinarchive.cwhen compression is requested but zlib is not availabledata.cby addingfclose(in)before early return statements invalidate_file_pages()realloc()withpgut_realloc()infile.cto prevent memory leaks on allocation failurevalidate.cand initializebase_full_backupto NULLunknownMacro)