Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverity fix #1478

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

reicheratwork
Copy link
Contributor

Fixed a number of code issues as reported by Coverity:

  • ignoring unused return values (most issues)
  • possible resource leaks
  • possible dereferencing nullpointer
  • goto'ing past variable initialization

Add (void) to ignore return value for fprintf calls which do not
use the returned value (for instance in the case of outputting to
stderr)

Signed-off-by: Martijn Reicher <[email protected]>
Add (void) to ignore return value for printf calls which do not
use the returned value

Signed-off-by: Martijn Reicher <[email protected]>
Add (void) to ignore return value for dds_delete calls which do not
use the returned value

Signed-off-by: Martijn Reicher <[email protected]>
Add (void) to ignore return value for ddsrt_hh_add calls which do not
use the returned value

Signed-off-by: Martijn Reicher <[email protected]>
Add (void) to ignore return value for pthread_setspecific calls which
do not use the returned value

Signed-off-by: Martijn Reicher <[email protected]>
Moved declaration of variables to beginning of function to avoid
issues with branching past their initialization

Signed-off-by: Martijn Reicher <[email protected]>
Add setting of pointer freed heap memory to NULL to avoid dereferencing
or freeing this block again

Signed-off-by: Martijn Reicher <[email protected]>
Add check for buffer creation on heap completing succesfully,
if the calloc function does not create a buffer, the function
add_union_case will return IDL_RETCODE_NO_MEMORY

Signed-off-by: Martijn Reicher <[email protected]>
Moved declaration of variables to beginning of function to avoid
issues with branching past their initialization

Signed-off-by: Martijn Reicher <[email protected]>
Add (void) to calls to scan_token where the return value is not used

Signed-off-by: Martijn Reicher <[email protected]>
Add (void) to calls to cnv_trigraph where the return value in not
used

Signed-off-by: Martijn Reicher <[email protected]>
Add (void) to calls to get_ch where the return value in not
used

Signed-off-by: Martijn Reicher <[email protected]>
Add correct cleanup of malloc'ed variable fullname

Signed-off-by: Martijn Reicher <[email protected]>
Add (void) to calls to snprintf to ignore return values where they
are not used

Signed-off-by: Martijn Reicher <[email protected]>
Add (void) to calls to skip_ws to ignore return values where they
are not used

Signed-off-by: Martijn Reicher <[email protected]>
Add (void) before calls to fputs where the return value is not
used
Add check on return value for calls to fputs in function printrst
in file generate_rst.c

Signed-off-by: Martijn Reicher <[email protected]>
Add (void) to calls to strlcpy to explicitly ignore the return value
in cases where it goes unused

Signed-off-by: Martijn Reicher <[email protected]>
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