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

Resolve cppcheck warnings #3392

Closed
shimpe opened this Issue Jan 6, 2018 · 5 comments

Comments

Projects
None yet
3 participants
@shimpe
Contributor

shimpe commented Jan 6, 2018

Just for fun and giggles I tried to run cppcheck on the supercollider source code (checkout ea28126 of master branch) and it found some interesting problems:

  • supercollider/server/plugins/Loudness.cpp

line 189: Array 'phons[11]' accessed at index 11, which is out of bounds.

  • supercollider/server/scsynth/SC_ComPort.cpp

line 407: Parameter 'bindTo' is passed by value. It could be passed as a (const) reference which is usually faster and recommended in C++.

  • supercollider/server/scsynth/SC_CoreAudio.cpp

line 558: 'auto_ptr' destroys objects using operator 'delete'. But this object is created with new[] and therefore should be deleted with delete[] instead. Don't use auto_ptr objects created by new[].

  • supercollider/server/scsynth/SC_GraphDef.cpp

lines 845 and 858: Common realloc mistake: 'refs' is nulled but not freed upon failure

  • supercollider/server/scsynth/SC_Group.cpp

lines 175 and 361: Memory leak "names"

  • supercollider/server/scsynth/SC_SequencedCommand.cpp

macro SEND_COMPLETION_MSG fails to initialize struct member: packet.mIsBundle

  • supercollider/server/scsynth/SC_World.cpp

line 1291: va_list 'vargs' was opened but not closed by va_end()

  • supercollider/server/supernova/sc/sc_osc_handler.cpp

line 194: No 'return' statement in non-void function causes undefined behavior

  • supercollider/server/supernova/server/server.hpp

line 294: va_list 'vargs' was opened but not closed by va_end()

  • supercollider/server/supernova/server/synth_factory.hpp

lines 37, 62, 79: The iterator 'it' is invalid after the element it pointed to has been erased. Dereferencing or comparing it with another iterator is invalid operation.

  • supercollider/server/supernova/sc/sc_synth.cpp

line 280: va_list 'vargs' was opened but not closed by va_end()

  • supercollider/server/supernova/server/server.cpp

line 366: va_list 'vargs' was opened but not closed by va_end()

@brianlheim

This comment has been minimized.

Show comment
Hide comment
@brianlheim

brianlheim Jan 6, 2018

Member

@shimpe - Thanks! This is related to #2927, which I started but lost track of. I'm going to rename this to match. Are these all the errors, or are these just the most severe?

Member

brianlheim commented Jan 6, 2018

@shimpe - Thanks! This is related to #2927, which I started but lost track of. I'm going to rename this to match. Are these all the errors, or are these just the most severe?

@brianlheim brianlheim changed the title from cppcheck results to Resolve cppcheck warnings Jan 6, 2018

@brianlheim brianlheim added this to the future milestone Jan 6, 2018

@shimpe

This comment has been minimized.

Show comment
Hide comment
@shimpe

shimpe Jan 6, 2018

Contributor

these are the errors that cppcheck could find; however it chokes in many files on parsing errors (apparently it has trouble resolving the PluginLoad macro)

Contributor

shimpe commented Jan 6, 2018

these are the errors that cppcheck could find; however it chokes in many files on parsing errors (apparently it has trouble resolving the PluginLoad macro)

@shimpe

This comment has been minimized.

Show comment
Hide comment
@shimpe

shimpe Jan 6, 2018

Contributor

And now I notice I only examined the errors in the server directory... maybe it's easier if I just append the results in cppcheck's native xml format.

result.txt

Contributor

shimpe commented Jan 6, 2018

And now I notice I only examined the errors in the server directory... maybe it's easier if I just append the results in cppcheck's native xml format.

result.txt

shimpe added a commit to shimpe/supercollider that referenced this issue Jan 6, 2018

shimpe added a commit to shimpe/supercollider that referenced this issue Jan 6, 2018

shimpe added a commit to shimpe/supercollider that referenced this issue Jan 6, 2018

shimpe added a commit to shimpe/supercollider that referenced this issue Jan 6, 2018

shimpe added a commit to shimpe/supercollider that referenced this issue Jan 6, 2018

shimpe added a commit to shimpe/supercollider that referenced this issue Jan 6, 2018

shimpe added a commit to shimpe/supercollider that referenced this issue Jan 6, 2018

shimpe added a commit to shimpe/supercollider that referenced this issue Jan 6, 2018

shimpe added a commit to shimpe/supercollider that referenced this issue Jan 6, 2018

@muellmusik

This comment has been minimized.

Show comment
Hide comment
@muellmusik

muellmusik Jan 7, 2018

Contributor
Contributor

muellmusik commented Jan 7, 2018

shimpe added a commit to shimpe/supercollider that referenced this issue Jan 9, 2018

shimpe added a commit to shimpe/supercollider that referenced this issue Jan 9, 2018

shimpe added a commit to shimpe/supercollider that referenced this issue Jan 10, 2018

shimpe added a commit to shimpe/supercollider that referenced this issue Jan 10, 2018

shimpe added a commit to shimpe/supercollider that referenced this issue Jan 11, 2018

shimpe added a commit to shimpe/supercollider that referenced this issue Jan 11, 2018

shimpe added a commit to shimpe/supercollider that referenced this issue Jan 11, 2018

shimpe added a commit to shimpe/supercollider that referenced this issue Jan 11, 2018

shimpe added a commit to shimpe/supercollider that referenced this issue Jan 11, 2018

brianlheim added a commit to brianlheim/supercollider that referenced this issue Jan 16, 2018

brianlheim added a commit to brianlheim/supercollider that referenced this issue Jan 16, 2018

brianlheim added a commit to brianlheim/supercollider that referenced this issue Jan 16, 2018

brianlheim added a commit to brianlheim/supercollider that referenced this issue Jan 16, 2018

brianlheim added a commit to brianlheim/supercollider that referenced this issue Jan 16, 2018

brianlheim added a commit to brianlheim/supercollider that referenced this issue Jan 16, 2018

brianlheim added a commit to brianlheim/supercollider that referenced this issue Jan 16, 2018

brianlheim added a commit to brianlheim/supercollider that referenced this issue Jan 16, 2018

brianlheim added a commit to brianlheim/supercollider that referenced this issue Jan 16, 2018

brianlheim added a commit to brianlheim/supercollider that referenced this issue Jan 16, 2018

brianlheim added a commit to brianlheim/supercollider that referenced this issue Jan 16, 2018

brianlheim added a commit to brianlheim/supercollider that referenced this issue Jan 16, 2018

brianlheim added a commit to brianlheim/supercollider that referenced this issue Jan 16, 2018

brianlheim added a commit to brianlheim/supercollider that referenced this issue Jan 16, 2018

brianlheim added a commit to brianlheim/supercollider that referenced this issue Jan 16, 2018

brianlheim added a commit to brianlheim/supercollider that referenced this issue Jan 16, 2018

brianlheim added a commit to brianlheim/supercollider that referenced this issue Jan 16, 2018

brianlheim added a commit to brianlheim/supercollider that referenced this issue Jan 16, 2018

@brianlheim

This comment has been minimized.

Show comment
Hide comment
@brianlheim

brianlheim Jan 16, 2018

Member

@shimpe - OK to close this now?

Member

brianlheim commented Jan 16, 2018

@shimpe - OK to close this now?

@shimpe shimpe closed this Jan 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment