Skip to content

Fix possible double free - #16

Closed
peter15914 wants to merge 1 commit into
ClickHouse:ClickHouse/libssh-0.12.0from
peter15914:fix_double_free
Closed

Fix possible double free#16
peter15914 wants to merge 1 commit into
ClickHouse:ClickHouse/libssh-0.12.0from
peter15914:fix_double_free

Conversation

@peter15914

Copy link
Copy Markdown

Issue:
entry_list is freed with ssh_list_free().
If list_error is true, it is freed again with ssh_knownhosts_entries_free(), causing double free.

Context:
list_error is true only if ssh_list_append() returns an error, this occurs when malloc() fails and returns NULL in ssh_iterator_new().

Found with Svace static analyzer.

entry_list is freed with ssh_list_free(). If list_error is true, it is freed again with ssh_knownhosts_entries_free(), causing double free.
@peter15914
peter15914 marked this pull request as ready for review September 9, 2026 19:31
@rschu1ze

Copy link
Copy Markdown
Member

@peter15914 Please send the fix to the upstream repository.

@rschu1ze rschu1ze closed this Sep 10, 2026
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

Successfully merging this pull request may close these issues.

2 participants