mosquitto
mosquitto copied to clipboard
Config file parsing leads to memory leak.
This might not be a leak that will accumulate. But since there is an option to exit gracefully, it would be nice to release all the resources while doing that.
Version: 2.0.18 Method to reproduce:
valgrind --leak-check=full mosquitto -c my_config.conf
^C
Valgrind log:
==9722==
==9722== HEAP SUMMARY:
==9722== in use at exit: 171 bytes in 2 blocks
==9722== total heap usage: 29,794 allocs, 29,792 frees, 2,489,088 bytes allocated
==9722==
==9722== 171 (136 direct, 35 indirect) bytes in 1 blocks are definitely lost in loss record 2 of 2
==9722== at 0x4874D24: malloc (vg_replace_malloc.c:392)
==9722== by 0x487B323: realloc (vg_replace_malloc.c:1451)
==9722== by 0x28C3F: mosquitto__realloc (memory_mosq.c:130)
==9722== by 0x1A541: config__read_file_core (conf.c:889)
==9722== by 0x1D9FF: config__read_file (conf.c:2232)
==9722== by 0x19A13: config__read (conf.c:625)
==9722== by 0x18E5B: config__parse_args (conf.c:383)
==9722== by 0x1594D: main (mosquitto.c:502)
==9722==
==9722== LEAK SUMMARY:
==9722== definitely lost: 136 bytes in 1 blocks
==9722== indirectly lost: 35 bytes in 1 blocks
==9722== possibly lost: 0 bytes in 0 blocks
==9722== still reachable: 0 bytes in 0 blocks
==9722== suppressed: 0 bytes in 0 blocks
==9722==
==9722== For lists of detected and suppressed errors, rerun with: -s
==9722== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)