Skip to content

Commit 94e9599

Browse files
guohao15xiaoxiang781216
authored andcommitted
file_lock:fix memory alloc/free not match
Signed-off-by: guohao15 <[email protected]>
1 parent 76a1a5b commit 94e9599

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

fs/vfs/fs_lock.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,16 @@ file_lock_find_bucket(FAR const char *filepath)
292292
return NULL;
293293
}
294294

295+
/****************************************************************************
296+
* Name: file_lock_free_entry
297+
****************************************************************************/
298+
299+
static void file_lock_free_entry(FAR ENTRY *entry)
300+
{
301+
lib_free(entry->key);
302+
kmm_free(entry->data);
303+
}
304+
295305
/****************************************************************************
296306
* Name: file_lock_create_bucket
297307
****************************************************************************/
@@ -824,5 +834,6 @@ void file_initlk(void)
824834
{
825835
/* Initialize file lock context hash table */
826836

837+
g_file_lock_table.free_entry = file_lock_free_entry;
827838
hcreate_r(CONFIG_FS_LOCK_BUCKET_SIZE, &g_file_lock_table);
828839
}

0 commit comments

Comments
 (0)