Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • Samba Samba
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Merge requests 153
    • Merge requests 153
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • The Samba TeamThe Samba Team
  • SambaSamba
  • Merge requests
  • !1627

lib:util:loadparm - fix leak in lpcfg_dump_a_parameter

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Andrew Walker requested to merge samba-team/devel/samba:anodos325-fix-minor-leak-in-loadparm into master Oct 21, 2020
  • Overview 3
  • Commits 1
  • Pipelines 1
  • Changes 1

This is an OCD fix and so it is fairly low priority. lpcfg_dump_a_parameter doesn't free a temporary string allocated under loadparm context.

I was experimenting with pyparam / talloc and noticed the following behavior:

>>> talloc.report_full(a)
full talloc report on 'struct loadparm_context' (total    166 bytes in   5 blocks)
    /usr/local/etc/smb4.conf       contains     25 bytes in   1 blocks (ref 0) 0x800a49060
    passdb backend                 contains     15 bytes in   1 blocks (ref 0) 0x800a74f00
    passdb backend                 contains     15 bytes in   1 blocks (ref 0) 0x800a74020
    passbd backend                 contains     15 bytes in   1 blocks (ref 0) 0x800a730d0
>>> a.dump_a_parameter('passdb backend')
tdbsam
>>> talloc.report_full(a)
full talloc report on 'struct loadparm_context' (total    181 bytes in   6 blocks)
    passdb backend                 contains     15 bytes in   1 blocks (ref 0) 0x800a75440
    /usr/local/etc/smb4.conf       contains     25 bytes in   1 blocks (ref 0) 0x800a49060
    passdb backend                 contains     15 bytes in   1 blocks (ref 0) 0x800a74f00
    passdb backend                 contains     15 bytes in   1 blocks (ref 0) 0x800a74020
    passbd backend                 contains     15 bytes in   1 blocks (ref 0) 0x800a730d0

Obviously this is a minor issue because the get() method is probably more appropriate in most circumstances.

https://bugzilla.samba.org/show_bug.cgi?id=14544

Checklist

  • Commits have Signed-off-by: with name/author being identical to the commit author
  • (optional) This MR is just one part towards a larger feature.
  • (optional, if backport required) Bugzilla bug filed and BUG: tag added
  • Test suite updated with functionality tests
  • Test suite updated with negative tests
  • Documentation updated
  • CI timeout is 3h or higher (see Settings/CICD/General pipelines/ Timeout)

Reviewer's checklist:

  • There is a test suite reasonably covering new functionality or modifications
  • Function naming, parameters, return values, types, etc., are consistent and according to README.Coding.md
  • This feature/change has adequate documentation added
  • No obvious mistakes in the code
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: anodos325-fix-minor-leak-in-loadparm