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

Cppcheck warnings #563

Open
Harvie opened this issue Dec 5, 2020 · 1 comment
Open

Cppcheck warnings #563

Harvie opened this issue Dec 5, 2020 · 1 comment

Comments

@Harvie
Copy link

Harvie commented Dec 5, 2020

There is huge ammount of cppcheck warnings in this repo, i only hand-picked few of them, which seemed most relevant:

$ cppcheck --force deps/modules/mongoose-os >/dev/null

deps/modules/mongoose-os/platforms/stm32/src/stm32_entry.c:33:46: error: Subtracting pointers that point to different objects [comparePointers]
  memset(&_bss_start, 0, ((char *) &_bss_end - (char *) &_bss_start));
                                             ^
deps/modules/mongoose-os/platforms/stm32/src/stm32_entry.c:35:31: error: Subtracting pointers that point to different objects [comparePointers]
         ((char *) &_data_end - (char *) &_data_start));

deps/modules/mongoose-os/platforms/stm32/src/stm32_entry.c:36:48: error: Subtracting pointers that point to different objects [comparePointers]
  memset(&_heap_start, 0, ((char *) &_heap_end - (char *) &_heap_start));
                                               ^
deps/modules/mongoose-os/src/common/cs_file.c:44:9: error: Resource leak: fp [resourceLeak]
        return NULL;
        ^
deps/modules/mongoose-os/src/common/cs_frbuf.c:90:26: error: Memory leak: b [memleak]
      if (b->fp == NULL) return false;
                         ^
deps/modules/mongoose-os/src/mgos_core_dump.c:94:31: error: There is an unknown macro here somewhere. Configuration is required. If CS_STRINGIFY_MACRO is a macro then please configure it. [unknownMacro]
  mgos_cd_puts("\"arch\": \"" CS_STRINGIFY_MACRO(FW_ARCHITECTURE) "\", ");
                              ^
deps/modules/mongoose-os/src/mgos_sys_config.c:387:3: error: Common realloc mistake: 's_validators' nulled but not freed upon failure [memleakOnRealloc]
  s_validators = (mgos_config_validator_fn *) realloc(
  ^
deps/modules/mongoose-os/src/status_test.cpp:21:1: error: syntax error [syntaxError]
TEST(StatusTest, DefaultConstructedOK) {
^
deps/modules/mongoose-os/src/statusor_test.cpp:38:1: error: syntax error [syntaxError]
TEST(StatsOrTest, DefaulConstructedUnknown) {
^
@rojer
Copy link
Collaborator

rojer commented Dec 5, 2020

only some of these are useful. please send PRs for those that make sense.

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

No branches or pull requests

2 participants