#2405 closed defect (fixed)
CppCheck errors being reported throughout the code
Reported by: | Martin Galvan | Owned by: | Martin Galvan <martin.galvan@…> |
---|---|---|---|
Priority: | normal | Milestone: | 4.11.1 |
Component: | unspecified | Version: | 4.11 |
Severity: | normal | Keywords: | |
Cc: | Joel Sherrill, daniel.gutson@… | Blocked By: | |
Blocking: |
Description
I performed a run of cppcheck --enable-all
on the git master and the following items were reported as 'error':
[c/src/lib/libbsp/shared/umon/umon.h:21]: (error) Invalid number of character ({) when these macros are defined: '__cplusplus'. [cpukit/libmisc/dumpbuf/dumpbuf.c:69]: (error) Undefined behavior: Variable 'line_buffer' is used as parameter and destination in s[n]printf(). [cpukit/libmisc/dumpbuf/dumpbuf.c:76]: (error) Undefined behavior: Variable 'line_buffer' is used as parameter and destination in s[n]printf(). [cpukit/libnetworking/rtems/rtems_dhcp.c:401]: (error) Common realloc mistake: 'dhcp_hostname' nulled but not freed upon failure [cpukit/posix/include/rtems/posix/ptimer.h:33]: (error) Invalid number of character ({) when these macros are defined: '__cplusplus'. [cpukit/rtems/include/rtems/rtems/dpmemimpl.h:104]: (error) Invalid number of character ({) when these macros are defined: '__cplusplus'. [tools/cpu/nios2/memory.c:99]: (error) Uninitialized variable: memory [tools/cpu/nios2/ptf.c:582]: (error) Memory leak: new_prefix
Notice I ran cppcheck mostly on the modules I'm currently using (that means most BSPs weren't checked). Some other errors may show up when running it on the entire source.
Change History (8)
comment:1 follow-up: 2 Changed on 09/01/15 at 21:41:51 by Joel Sherrill
comment:2 Changed on 09/01/15 at 22:02:50 by Martin Galvan
Replying to joel.sherrill:
I posted proposed fixes for all of these except the rtems_dhcp.c one. Please review and let me know.
It looks fine to me. However, if you don't mind me asking:
1) What's wrong with the rtems_dhcp fix?
2) In nios2/ptf.c I added a check for the return value of malloc, but the patch you sent only adds the missing free
. Was there something wrong with that check?
Thanks a lot!
comment:3 Changed on 09/03/15 at 16:27:59 by Martin Galvan <martin.galvan@…>
Owner: | set to Martin Galvan <martin.galvan@…> |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:4 Changed on 09/03/15 at 16:28:29 by Martin Galvan <martin.galvan@…>
comment:5 Changed on 09/03/15 at 17:33:38 by Martin Galvan <martin.galvan@…>
comment:6 Changed on 09/03/15 at 17:34:15 by Martin Galvan <martin.galvan@…>
comment:7 Changed on 09/03/15 at 20:42:52 by Martin Galvan <martin.galvan@…>
comment:8 Changed on 09/03/15 at 20:43:14 by Martin Galvan <martin.galvan@…>
Note: See
TracTickets for help on using
tickets.
I posted proposed fixes for all of these except the rtems_dhcp.c one. Please review and let me know.