From 22b712687fa09f34e92d3d7c4d6a9692e36578db Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Mon, 22 Oct 2007 23:13:23 +0000 Subject: [PATCH] Cleanup partition map management --- libstream/stream_open.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/libstream/stream_open.c b/libstream/stream_open.c index 8d79054..841258f 100644 --- a/libstream/stream_open.c +++ b/libstream/stream_open.c @@ -186,21 +186,29 @@ stream_t *stream_open(char *dev) map = map_open(&stream->device); if (map == NULL) - goto map_error; + { + stream->device.close(&stream->device); + free(stream); + return NULL; + } stream->device.data = map; ret = map_read(map, partition); 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.close = (stream_close_t)map_close; -map_read_error: map_close(map); -map_error: -#endif /* MAP_SUPPORT */ +#else stream->device.close(&stream->device); free(stream); return NULL; +#endif /* MAP_SUPPORT */ } switch(fs)