Skip to content

Build failure: LeakSanitizer detects memory leaks in plugins/sql.c (init_tablemap()) #8802

@Chand-ra

Description

@Chand-ra

Description:

I am encountering a compilation failure on the master branch (v25.05-942-gbb5b8d7) when building with Clang and sanitizers enabled. The build process fails when linking or executing plugins/sql, with LeakSanitizer reporting roughly 1.4KB of leaked memory in strmap_add_() and new_table_desc().

Build Environment:

  • OS: Ubuntu 24.04.02 (LTS)
  • Compiler: Ubuntu clang version 18.1.3
  • CLN Version: v25.05-942-gbb5b8d7
  • Configure Flags: config.vars file

Actual Behavior:

The build fails with the following AddressSanitizer error:

==10398==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x638082d43613 in malloc (/home/chandra/lightning/plugins/sql+0x269613) (BuildId: 4cf5c8f907465249888523c35734c752c0b6039e)
    #1 0x6380830041e1 in strmap_add_ /home/chandra/lightning/ccan/ccan/strmap/strmap.c:95:9
    #2 0x638082d857af in new_table_desc /home/chandra/lightning/plugins/sql.c:1672:3
    #3 0x638082d83004 in init_tablemap /home/chandra/lightning/plugins/sql.c:1836:8
    #4 0x638082d820e3 in main /home/chandra/lightning/plugins/sql.c:1980:3
    #5 0x703de362a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #6 0x703de362a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    #7 0x638082ca87c4 in _start (/home/chandra/lightning/plugins/sql+0x1ce7c4) (BuildId: 4cf5c8f907465249888523c35734c752c0b6039e)

Indirect leak of 672 byte(s) in 14 object(s) allocated from:
    #0 0x638082d43613 in malloc (/home/chandra/lightning/plugins/sql+0x269613) (BuildId: 4cf5c8f907465249888523c35734c752c0b6039e)
    #1 0x6380830041e1 in strmap_add_ /home/chandra/lightning/ccan/ccan/strmap/strmap.c:95:9
    #2 0x638082d857af in new_table_desc /home/chandra/lightning/plugins/sql.c:1672:3
    #3 0x638082d83004 in init_tablemap /home/chandra/lightning/plugins/sql.c:1836:8
    #4 0x638082d820e3 in main /home/chandra/lightning/plugins/sql.c:1980:3
    #5 0x703de362a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #6 0x703de362a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    #7 0x638082ca87c4 in _start (/home/chandra/lightning/plugins/sql+0x1ce7c4) (BuildId: 4cf5c8f907465249888523c35734c752c0b6039e)

Indirect leak of 384 byte(s) in 8 object(s) allocated from:
    #0 0x638082d43613 in malloc (/home/chandra/lightning/plugins/sql+0x269613) (BuildId: 4cf5c8f907465249888523c35734c752c0b6039e)
    #1 0x6380830041e1 in strmap_add_ /home/chandra/lightning/ccan/ccan/strmap/strmap.c:95:9
    #2 0x638082d857af in new_table_desc /home/chandra/lightning/plugins/sql.c:1672:3
    #3 0x638082da1f50 in add_table_properties /home/chandra/lightning/plugins/sql.c:1759:15
    #4 0x638082d858a2 in add_table_object /home/chandra/lightning/plugins/sql.c:1793:3
    #5 0x638082d83019 in init_tablemap /home/chandra/lightning/plugins/sql.c:1837:3
    #6 0x638082d820e3 in main /home/chandra/lightning/plugins/sql.c:1980:3
    #7 0x703de362a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #8 0x703de362a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    #9 0x638082ca87c4 in _start (/home/chandra/lightning/plugins/sql+0x1ce7c4) (BuildId: 4cf5c8f907465249888523c35734c752c0b6039e)

Indirect leak of 192 byte(s) in 4 object(s) allocated from:
    #0 0x638082d43613 in malloc (/home/chandra/lightning/plugins/sql+0x269613) (BuildId: 4cf5c8f907465249888523c35734c752c0b6039e)
    #1 0x6380830041e1 in strmap_add_ /home/chandra/lightning/ccan/ccan/strmap/strmap.c:95:9
    #2 0x638082d857af in new_table_desc /home/chandra/lightning/plugins/sql.c:1672:3
    #3 0x638082da1f50 in add_table_properties /home/chandra/lightning/plugins/sql.c:1759:15
    #4 0x638082d858a2 in add_table_object /home/chandra/lightning/plugins/sql.c:1793:3
    #5 0x638082da267b in add_table_properties /home/chandra/lightning/plugins/sql.c:1767:4
    #6 0x638082d858a2 in add_table_object /home/chandra/lightning/plugins/sql.c:1793:3
    #7 0x638082d83019 in init_tablemap /home/chandra/lightning/plugins/sql.c:1837:3
    #8 0x638082d820e3 in main /home/chandra/lightning/plugins/sql.c:1980:3
    #9 0x703de362a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #10 0x703de362a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    #11 0x638082ca87c4 in _start (/home/chandra/lightning/plugins/sql+0x1ce7c4) (BuildId: 4cf5c8f907465249888523c35734c752c0b6039e)

Indirect leak of 96 byte(s) in 2 object(s) allocated from:
    #0 0x638082d43613 in malloc (/home/chandra/lightning/plugins/sql+0x269613) (BuildId: 4cf5c8f907465249888523c35734c752c0b6039e)
    #1 0x6380830041e1 in strmap_add_ /home/chandra/lightning/ccan/ccan/strmap/strmap.c:95:9
    #2 0x638082d857af in new_table_desc /home/chandra/lightning/plugins/sql.c:1672:3
    #3 0x638082da1f50 in add_table_properties /home/chandra/lightning/plugins/sql.c:1759:15
    #4 0x638082d858a2 in add_table_object /home/chandra/lightning/plugins/sql.c:1793:3
    #5 0x638082d85bc2 in add_table_object /home/chandra/lightning/plugins/sql.c:1803:3
    #6 0x638082d85b1e in add_table_object /home/chandra/lightning/plugins/sql.c:1798:4
    #7 0x638082d83019 in init_tablemap /home/chandra/lightning/plugins/sql.c:1837:3
    #8 0x638082d820e3 in main /home/chandra/lightning/plugins/sql.c:1980:3
    #9 0x703de362a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #10 0x703de362a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    #11 0x638082ca87c4 in _start (/home/chandra/lightning/plugins/sql+0x1ce7c4) (BuildId: 4cf5c8f907465249888523c35734c752c0b6039e)

SUMMARY: AddressSanitizer: 1392 byte(s) leaked in 29 allocation(s).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions