Bug 15230 - Memory leak in snprintf replacement functions
Summary: Memory leak in snprintf replacement functions
Status: RESOLVED FIXED
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/-...
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-09 09:43 UTC by Stefan Metzmacher
Modified: 2022-11-23 14:51 UTC (History)
5 users (show)

See Also:


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

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:

76adda9d2fea9f93f4cf97536db5c0be6deeb98c
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

Thanks
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:

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

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

Thanks!