block: fix invalid free condition
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
b8560b4577
commit
1a8061e3b3
1 changed files with 4 additions and 4 deletions
|
|
@ -22,11 +22,11 @@ int block_device_register(char *name, size_t lba_start, struct block_ops *ops, s
|
|||
strncpy(ret->name, name, sizeof(ret->name) - 1);
|
||||
*out = ret;
|
||||
|
||||
memcpy(ops, &ret->ops, sizeof(struct block_ops));
|
||||
memcpy(&ret->ops, ops, sizeof(struct block_ops));
|
||||
|
||||
dirent_t *dirent;
|
||||
int res = devfs_insert_device_blk(ret->name, ret, &dirent);
|
||||
(void)res;
|
||||
(void)res;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -39,7 +39,7 @@ int block_check_partitions(struct block_device *bdev)
|
|||
int ret = 0;
|
||||
|
||||
if (block_has_gpt_header(bdev)) {
|
||||
struct gpt_partition *descs;
|
||||
struct gpt_partition *descs = NULL;
|
||||
int n_partitions = gpt_parse_partitions(bdev, &descs);
|
||||
|
||||
for (int i = 0; i < n_partitions; i++) {
|
||||
|
|
@ -56,7 +56,7 @@ int block_check_partitions(struct block_device *bdev)
|
|||
krdy("registered block device /dev/%s\n", blkdev->name);
|
||||
}
|
||||
|
||||
if (n_partitions)
|
||||
if (descs)
|
||||
kfree(descs);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue