mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 09:49:21 +08:00
inotify:fix memory alloc/free not match
Signed-off-by: guohao15 <guohao15@xiaomi.com>
This commit is contained in:
parent
c63adb5c14
commit
76a1a5b2c4
1 changed files with 17 additions and 0 deletions
|
@ -1009,6 +1009,22 @@ static inline void notify_queue_filep_event(FAR struct file *filep,
|
|||
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
|
||||
****************************************************************************/
|
||||
|
@ -1276,6 +1292,7 @@ void notify_initialize(void)
|
|||
{
|
||||
int ret;
|
||||
|
||||
g_inotify.hash.free_entry = notify_free_entry;
|
||||
ret = hcreate_r(CONFIG_FS_NOTIFY_BUCKET_SIZE, &g_inotify.hash);
|
||||
if (ret != 1)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue