[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240314115532.5ac9a177@kernel.org>
Date: Thu, 14 Mar 2024 11:55:32 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Zijie Zhao <zzjas98@...il.com>
Cc: davem@...emloft.net, edumazet@...gle.com, pabeni@...hat.com,
netdev@...r.kernel.org, chenyuan0y@...il.com
Subject: Re: [drivers/net/netdevsim] Question about possible memleak
On Wed, 13 Mar 2024 21:13:18 -0500 Zijie Zhao wrote:
> Here if the `err_nsim_bus_dev_id_free` label is entered,
> `nsim_bus_dev` will be assigned `NULL` and then `kfree(nsim_bus_dev)`
> will not free the allocated memory.
>
> Please kindly correct us if we missed any key information. Looking
> forward to your response!
/**
* device_register - register a device with the system.
* @dev: pointer to the device structure
*
* This happens in two clean steps - initialize the device
* and add it to the system. The two steps can be called
* separately, but this is the easiest and most common.
* I.e. you should only call the two helpers separately if
* have a clearly defined need to use and refcount the device
* before it is added to the hierarchy.
*
* For more information, see the kerneldoc for device_initialize()
* and device_add().
*
* NOTE: _Never_ directly free @dev after calling this function, even
* if it returned an error! Always use put_device() to give up the
* reference initialized in this function instead.
*/
int device_register(struct device *dev)
Powered by blists - more mailing lists