Patch by Bryce Groff with small change by myself:
* Don't leak the driver settings handle. * No need to get the "active" parameter in ValidateCreateChild() -- either way is fine. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32098 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -349,8 +349,8 @@ PartitionMapHandle::ValidateCreateChild(off_t* _offset, off_t* _size,
|
|||||||
void* handle = parse_driver_settings_string(parameters);
|
void* handle = parse_driver_settings_string(parameters);
|
||||||
if (handle == NULL)
|
if (handle == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
get_driver_boolean_parameter(handle, "active", false, true);
|
||||||
bool active = get_driver_boolean_parameter(handle, "active", false, true);
|
delete_driver_settings(handle);
|
||||||
|
|
||||||
// do we have a spare primary partition?
|
// do we have a spare primary partition?
|
||||||
if (fPartitionMap.CountNonEmptyPrimaryPartitions() == 4)
|
if (fPartitionMap.CountNonEmptyPrimaryPartitions() == 4)
|
||||||
@@ -467,6 +467,7 @@ PartitionMapHandle::CreateChild(off_t offset, off_t size,
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
bool active = get_driver_boolean_parameter(handle, "active", false, true);
|
bool active = get_driver_boolean_parameter(handle, "active", false, true);
|
||||||
|
delete_driver_settings(handle);
|
||||||
|
|
||||||
// get a spare primary partition
|
// get a spare primary partition
|
||||||
PrimaryPartition* primary = NULL;
|
PrimaryPartition* primary = NULL;
|
||||||
@@ -507,8 +508,6 @@ PartitionMapHandle::CreateChild(off_t offset, off_t size,
|
|||||||
if (!foundSpace)
|
if (!foundSpace)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
// everything looks good, do it
|
|
||||||
|
|
||||||
// create the child
|
// create the child
|
||||||
// (Note: the primary partition index is indeed the child index, since
|
// (Note: the primary partition index is indeed the child index, since
|
||||||
// we picked the first empty primary partition.)
|
// we picked the first empty primary partition.)
|
||||||
@@ -529,9 +528,6 @@ PartitionMapHandle::CreateChild(off_t offset, off_t size,
|
|||||||
// init the primary partition
|
// init the primary partition
|
||||||
primary->SetTo(offset, size, type.Type(), active, partition->BlockSize());
|
primary->SetTo(offset, size, type.Type(), active, partition->BlockSize());
|
||||||
|
|
||||||
// TODO: If the child is an extended partition, we should trigger its
|
|
||||||
// initialization.
|
|
||||||
|
|
||||||
*_child = child;
|
*_child = child;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user