Partitioning system: avoid leakage of resource

The storage returned from GetSession() was leaked

CID 10827
This commit is contained in:
Philippe Saint-Pierre 2011-11-27 23:35:36 -05:00
parent 342169dfe2
commit f6bd30f2af

View File

@ -54,10 +54,14 @@ identify_partition(int fd, partition_data *partition, void **cookie)
if (disc != NULL && disc->InitCheck() == B_OK) {
// If we have only a single session then we can let the file system
// drivers play directly with the device.
if (disc->GetSession(1) != NULL)
Session *session = disc->GetSession(1);
if (session != NULL) {
result = 0.9f;
delete session;
}
else
result = 0.1f;
*cookie = static_cast<void*>(disc);
} else
delete disc;