file_lock:fix memory alloc/free not match

Signed-off-by: guohao15 <guohao15@xiaomi.com>
This commit is contained in:
guohao15 2024-08-02 14:22:32 +08:00 committed by Xiang Xiao
parent 76a1a5b2c4
commit 94e9599e5c

View File

@ -292,6 +292,16 @@ file_lock_find_bucket(FAR const char *filepath)
return NULL; return NULL;
} }
/****************************************************************************
* Name: file_lock_free_entry
****************************************************************************/
static void file_lock_free_entry(FAR ENTRY *entry)
{
lib_free(entry->key);
kmm_free(entry->data);
}
/**************************************************************************** /****************************************************************************
* Name: file_lock_create_bucket * Name: file_lock_create_bucket
****************************************************************************/ ****************************************************************************/
@ -824,5 +834,6 @@ void file_initlk(void)
{ {
/* Initialize file lock context hash table */ /* Initialize file lock context hash table */
g_file_lock_table.free_entry = file_lock_free_entry;
hcreate_r(CONFIG_FS_LOCK_BUCKET_SIZE, &g_file_lock_table); hcreate_r(CONFIG_FS_LOCK_BUCKET_SIZE, &g_file_lock_table);
} }