Skip to content

qual: cppcheck fixes in c-files (one commit per issue) - #1188

Open
mdeweerd wants to merge 5 commits into
RsyncProject:masterfrom
mdeweerd:qual/cppcheck
Open

mdeweerd wants to merge 5 commits into
RsyncProject:masterfrom
mdeweerd:qual/cppcheck

Conversation

@mdeweerd

Copy link
Copy Markdown
Contributor

C-file fixes from the pre-commit flow branch, one commit per issue:

  • fix: poptint.c: free buffer on realloc failure (cppcheck memleakOnRealloc)
  • fix: authenticate.c: cppcheck fixes for base64 encoding and user checks
  • fix: loadparm.c: handle realloc result in expand_vars (memory leak)
  • qual: poptconfig.c: cppcheck fixes (const qualifiers, realloc temp var)
  • qual: fix multiple 'obvious' cppcheck notices

- Add null check for user parameter
- Make base64 encoding string constant
The function expand_vars was not properly handling the realloc result.
The original code did not assign the realloc result to the buf pointer, which could lead to memory leaks.
(Possibly out_of_memory() exits, but not sure in context).
- Change variable types from `char *` to `const char *` where appropriate (cppcheck)
- Add temporary variable `new_b` for realloc to prevent potential issues
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.

1 participant