Bug 15230 - Memory leak in snprintf replacement functions
Summary: Memory leak in snprintf replacement functions
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Other (show other bugs)
Version: 4.17.1
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Jule Anger
QA Contact: Samba QA Contact
URL: https://gitlab.com/samba-team/samba/-...
Depends on:
Reported: 2022-11-09 09:43 UTC by Stefan Metzmacher
Modified: 2022-11-23 14:51 UTC (History)
5 users (show)

See Also:

Patch for v4-17-test (1014 bytes, patch)
2022-11-09 11:56 UTC, Stefan Metzmacher
vl: review+
Patch for v4-16-test (1014 bytes, patch)
2022-11-09 11:57 UTC, Stefan Metzmacher
vl: review+

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Metzmacher 2022-11-09 09:43:54 UTC
Running 'smbcontrol winbindd pool-usage' on AIX revealed that the 'mallinfo:arena' field increased heavily with each run while the talloc memmory
stated constant.

The reason for this is using something like this '%*s', depth, string
in talloc_report_printf_helper(). The snprintf replacement code in 
lib/replace/snprintf.c allocates some extra pr_chunk for the '*' behavior.
which leaks.
Comment 1 Samba QA Contact 2022-11-09 11:19:04 UTC
This bug was referenced in samba master:

Comment 2 Stefan Metzmacher 2022-11-09 11:56:45 UTC
Created attachment 17640 [details]
Patch for v4-17-test
Comment 3 Stefan Metzmacher 2022-11-09 11:57:55 UTC
Created attachment 17641 [details]
Patch for v4-16-test
Comment 4 Volker Lendecke 2022-11-09 12:10:27 UTC
Jule, two patches for 4.16 and 4.17

Comment 5 Jule Anger 2022-11-23 07:12:35 UTC
Pushed to autobuild-v4-{17,16}-test.
Comment 6 Samba QA Contact 2022-11-23 13:53:09 UTC
This bug was referenced in samba v4-16-test:

Comment 7 Samba QA Contact 2022-11-23 13:57:11 UTC
This bug was referenced in samba v4-17-test:

Comment 8 Jule Anger 2022-11-23 14:51:38 UTC
Closing out bug report.