[Bug 3718] New: Small memory leak (+patch) in process_server_config_line_depth
bugzilla-daemon at mindrot.org
bugzilla-daemon at mindrot.org
Fri Aug 16 22:25:32 AEST 2024
https://bugzilla.mindrot.org/show_bug.cgi?id=3718
Bug ID: 3718
Summary: Small memory leak (+patch) in
process_server_config_line_depth
Product: Portable OpenSSH
Version: -current
Hardware: Other
OS: Linux
Status: NEW
Severity: enhancement
Priority: P5
Component: sshd
Assignee: unassigned-bugs at mindrot.org
Reporter: alarrosa at suse.com
Created attachment 3831
--> https://bugzilla.mindrot.org/attachment.cgi?id=3831&action=edit
Patch that fixes the memory leak
While running sshd under valgrind I noticed a small memory leak.
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. The attached patch adds
the missing free to fix this 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)
Btw, I submitted this also as a PR in github some days ago (see
https://github.com/openssh/openssh-portable/pull/515 ) but since it
doesn't seem to be very active, I decided to also submit it here.
--
You are receiving this mail because:
You are watching the assignee of the bug.
More information about the openssh-bugs
mailing list