mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 19:36:35 +08:00
inotify:fix memory alloc/free not match
Signed-off-by: guohao15 <guohao15@xiaomi.com>
This commit is contained in:
@@ -1009,6 +1009,22 @@ static inline void notify_queue_filep_event(FAR struct file *filep,
|
|||||||
nxmutex_unlock(&g_inotify.lock);
|
nxmutex_unlock(&g_inotify.lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: notify_free_entry
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Deallocate the hash entry.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static void notify_free_entry(FAR ENTRY *entry)
|
||||||
|
{
|
||||||
|
/* Key is alloced by lib_malloc, value is alloced by kmm_malloc */
|
||||||
|
|
||||||
|
lib_free(entry->key);
|
||||||
|
kmm_free(entry->data);
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -1276,6 +1292,7 @@ void notify_initialize(void)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
g_inotify.hash.free_entry = notify_free_entry;
|
||||||
ret = hcreate_r(CONFIG_FS_NOTIFY_BUCKET_SIZE, &g_inotify.hash);
|
ret = hcreate_r(CONFIG_FS_NOTIFY_BUCKET_SIZE, &g_inotify.hash);
|
||||||
if (ret != 1)
|
if (ret != 1)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user