mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
drivers: Destroy mutex and sem in the error path
also correct the order to ensure the memory free is last step Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Masayuki Ishikawa
parent
dee38ce3e8
commit
dca5a3483f
@@ -806,6 +806,10 @@ int ramlog_register(FAR const char *devpath, FAR char *buffer, size_t buflen)
|
||||
ret = register_driver(devpath, &g_ramlogfops, 0666, priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
nxmutex_destroy(&priv->rl_lock);
|
||||
#ifndef CONFIG_RAMLOG_NONBLOCKING
|
||||
nxsem_destroy(&priv->rl_waitsem);
|
||||
#endif
|
||||
kmm_free(priv);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user