mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 20:44:39 +08:00
rptun: fix memleak on failure
Leak backtrace:
1 14 2096 9886 0x4318d768 [0x040320744] <romfs_fileconfigure+184> romfs/fs_romfsutil.c:1039
[0x04031fd3e] <romfs_open+378> romfs/fs_romfs.c:281
[0x04027fa9e] <file_open+446> vfs/fs_open.c:244
[0x0402ab986] <rptun_store_open+26> rptun/rptun.c:955
[0x04034cc88] <remoteproc_load+120> open-amp/lib/remoteproc/remoteproc.c:452
[0x0402ac8ac] <rptun_dev_start+176> rptun/rptun.c:748
[0x0402ad038] <rptun_ioctl+416> rptun/rptun.c:618
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
This commit is contained in:
@@ -1022,7 +1022,13 @@ static int rptun_store_open(FAR void *store_,
|
||||
|
||||
*img_data = store->buf;
|
||||
|
||||
return file_read(&store->file, store->buf, len);
|
||||
ret = file_read(&store->file, store->buf, len);
|
||||
if (ret < 0)
|
||||
{
|
||||
file_close(&store->file);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void rptun_store_close(FAR void *store_)
|
||||
|
||||
Reference in New Issue
Block a user