* CID 874 and CID 875: Fix leaking the session object GetSession() allocates.
* CID 876: Fix leaking the disc object in case it fails to initialize. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27496 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -54,6 +54,8 @@ identify_partition(int fd, partition_data *partition, void **cookie)
|
|||||||
*cookie = static_cast<void*>(disc);
|
*cookie = static_cast<void*>(disc);
|
||||||
result = 0.7;
|
result = 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete disc;
|
||||||
}
|
}
|
||||||
PRINT(("returning %ld\n", int32(result * 10000)));
|
PRINT(("returning %ld\n", int32(result * 10000)));
|
||||||
return result;
|
return result;
|
||||||
@@ -89,6 +91,7 @@ scan_partition(int fd, partition_data *partition, void *cookie)
|
|||||||
child->block_size = session->BlockSize();
|
child->block_size = session->BlockSize();
|
||||||
child->flags |= session->Flags();
|
child->flags |= session->Flags();
|
||||||
child->type = strdup(session->Type());
|
child->type = strdup(session->Type());
|
||||||
|
delete session;
|
||||||
if (!child->type) {
|
if (!child->type) {
|
||||||
error = B_NO_MEMORY;
|
error = B_NO_MEMORY;
|
||||||
break;
|
break;
|
||||||
@@ -130,4 +133,3 @@ partition_module_info *modules[] = {
|
|||||||
&sSessionModule,
|
&sSessionModule,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user