mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-23 22:18:17 +00:00
dm: virtio-i2c: fix native_adapter memory leak
If failed to create native_adapter, free allocated native_adapter memory before return. Tracked-On: #3543 Signed-off-by: Yifan Luo <luoyifan@cmss.chinamobile.com>
This commit is contained in:
parent
5471473f60
commit
50e0a932a2
@ -449,7 +449,7 @@ native_adapter_create(int bus, uint16_t slave_addr[], int n_slave)
|
|||||||
fd = open(native_path, O_RDWR);
|
fd = open(native_path, O_RDWR);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
WPRINTF("virtio_i2c: failed to open %s\n", native_path);
|
WPRINTF("virtio_i2c: failed to open %s\n", native_path);
|
||||||
return NULL;
|
goto fail;
|
||||||
}
|
}
|
||||||
native_adapter->fd = fd;
|
native_adapter->fd = fd;
|
||||||
native_adapter->bus = bus;
|
native_adapter->bus = bus;
|
||||||
|
Loading…
Reference in New Issue
Block a user