diff --git a/fs/rpmsgfs/rpmsgfs_client.c b/fs/rpmsgfs/rpmsgfs_client.c index 5e2924ead2..c884a514ac 100644 --- a/fs/rpmsgfs/rpmsgfs_client.c +++ b/fs/rpmsgfs/rpmsgfs_client.c @@ -744,6 +744,7 @@ int rpmsgfs_client_bind(FAR void **handle, FAR const char *cpuname) return -ENOMEM; } + nxsem_init(&priv->wait, 0, 0); strlcpy(priv->cpuname, cpuname, sizeof(priv->cpuname)); ret = rpmsg_register_callback(priv, rpmsgfs_device_created, @@ -752,11 +753,11 @@ int rpmsgfs_client_bind(FAR void **handle, FAR const char *cpuname) NULL); if (ret < 0) { + nxsem_destroy(&priv->wait); fs_heap_free(priv); return ret; } - nxsem_init(&priv->wait, 0, 0); *handle = priv; return 0;