[Bug 265148] smbfs: fix potential memory leak in smbfs_node_alloc()

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 11 Jul 2022 07:59:59 UTC

            Bug ID: 265148
           Summary: smbfs: fix potential memory leak in smbfs_node_alloc()
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: niejianglei2021@163.com

smbfs_node_alloc() allocates memory chunk for np->n_name with
smbfs_name_alloc() and np->n_rpath, np with malloc(). When insmntque()
fails, only np is released while np->n_rpath and np->n_name is leaked.
The same leak occurs when vfs_hash_insert() fails.

We should release the relevant memory chunk with proper function when
error occurs to avoid the memory leak.

You are receiving this mail because:
You are the assignee for the bug.