Cleanup partition map management

This commit is contained in:
Laurent Vivier 2007-10-22 23:13:23 +00:00
parent 55aa4a8e04
commit 22b712687f

View File

@ -186,21 +186,29 @@ stream_t *stream_open(char *dev)
map = map_open(&stream->device); map = map_open(&stream->device);
if (map == NULL) if (map == NULL)
goto map_error; {
stream->device.close(&stream->device);
free(stream);
return NULL;
}
stream->device.data = map; stream->device.data = map;
ret = map_read(map, partition); ret = map_read(map, partition);
if (ret == -1) if (ret == -1)
goto map_read_error; {
map_close(map);
stream->device.close(&stream->device);
free(stream);
return NULL;
}
stream->device.read_sector = (stream_read_sector_t)map_read_sector; stream->device.read_sector = (stream_read_sector_t)map_read_sector;
stream->device.close = (stream_close_t)map_close; stream->device.close = (stream_close_t)map_close;
map_read_error:
map_close(map); map_close(map);
map_error: #else
#endif /* MAP_SUPPORT */
stream->device.close(&stream->device); stream->device.close(&stream->device);
free(stream); free(stream);
return NULL; return NULL;
#endif /* MAP_SUPPORT */
} }
switch(fs) switch(fs)