@@ -182,16 +182,16 @@ static int scan_header(struct partition *part)
part->header_cache = kmalloc(part->header_size, GFP_KERNEL);
if (!part->header_cache)
- goto err;
+ return -ENOMEM;
part->blocks = kcalloc(part->total_blocks, sizeof(struct block),
GFP_KERNEL);
if (!part->blocks)
- goto err;
+ goto free_cache;
part->sector_map = vmalloc(part->sector_count * sizeof(u_long));
if (!part->sector_map)
- goto err;
+ goto free_blocks;
for (i=0; i<part->sector_count; i++)
part->sector_map[i] = -1;
@@ -229,9 +229,10 @@ static int scan_header(struct partition *part)
err:
vfree(part->sector_map);
- kfree(part->header_cache);
+free_blocks:
kfree(part->blocks);
-
+free_cache:
+ kfree(part->header_cache);
return rc;
}