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

Fix a small memory leak in process_server_config_line_depth #515

Conversation

antlarr-suse
Copy link
Contributor

The return value of argv_assemble is owned by the caller and should be free'd. When processing the sSubsystem case there are two calls to argv_assemble but only one of them is freed. This patch fixes the small (29 bytes according to valgrind) memory leak.

The output from valgrind:

==115369== 29 bytes in 1 blocks are definitely lost in loss record 573 of 913
==115369==    at 0x4845794: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==115369==    by 0x124A22: argv_assemble (misc.c:2165)
==115369==    by 0x1385E5: process_server_config_line_depth.constprop.0 (servconf.c:2004)
==115369==    by 0x13984D: parse_server_config_depth.constprop.0 (servconf.c:3032)
==115369==    by 0x139986: parse_server_config.constprop.0 (servconf.c:3049)
==115369==    by 0x111C6E: main (sshd.c:1445)

The return value of argv_assemble is owned by the caller and should be
free'd. When processing the sSubsystem case there are two calls to
argv_assemble but only one of them is freed. This patch fixes the small
(29 bytes according to valgrind) memory leak.

The output from valgrind:
==115369== 29 bytes in 1 blocks are definitely lost in loss record 573 of 913
==115369==    at 0x4845794: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==115369==    by 0x124A22: argv_assemble (misc.c:2165)
==115369==    by 0x1385E5: process_server_config_line_depth.constprop.0 (servconf.c:2004)
==115369==    by 0x13984D: parse_server_config_depth.constprop.0 (servconf.c:3032)
==115369==    by 0x139986: parse_server_config.constprop.0 (servconf.c:3049)
==115369==    by 0x111C6E: main (sshd.c:1445)
@djmdjm
Copy link
Contributor

djmdjm commented Aug 17, 2024

Thanks applied upstream and synced back as 127a50f

@djmdjm djmdjm closed this Aug 17, 2024
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