mirror of
https://github.com/vivier/EMILE.git
synced 2024-06-11 12:29:30 +00:00
Duplicate device on open and free on close, close device on map close
This commit is contained in:
parent
2e5094aff9
commit
e134c95553
|
@ -11,5 +11,7 @@
|
|||
|
||||
void map_close(map_t *map)
|
||||
{
|
||||
map->device->close(map->device);
|
||||
free(map->device);
|
||||
free(map);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,13 @@ map_t* map_open(device_io_t *device)
|
|||
if (map == NULL)
|
||||
return NULL;
|
||||
|
||||
map->device = device;
|
||||
map->device = malloc(sizeof(device_io_t));
|
||||
if (map->device == NULL)
|
||||
{
|
||||
free(map);
|
||||
return NULL;
|
||||
}
|
||||
memcpy(map->device, device, sizeof(device_io_t));
|
||||
|
||||
ret = device->read_sector(map->device->data, 0,
|
||||
&map->drivers, sizeof(map->drivers));
|
||||
|
|
Loading…
Reference in New Issue
Block a user