From b1effc0c7750ad2a7b213510fb5dbb23c8f9be5d Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 13 Sep 2008 13:43:50 +0000 Subject: [PATCH] CID 316: If path can be null, path->InitCheck() shouldn't be used. Split it up into two seperate checks instead and return B_BAD_VALUE on a passed NULL path. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27475 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/disk_device_manager/KFileDiskDevice.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/system/kernel/disk_device_manager/KFileDiskDevice.cpp b/src/system/kernel/disk_device_manager/KFileDiskDevice.cpp index 7bd26f61e7..8b428abde7 100644 --- a/src/system/kernel/disk_device_manager/KFileDiskDevice.cpp +++ b/src/system/kernel/disk_device_manager/KFileDiskDevice.cpp @@ -187,8 +187,12 @@ KFileDiskDevice::_UnregisterDevice(const char *_device) status_t KFileDiskDevice::_GetDirectoryPath(partition_id id, KPath *path) { - if (!path || path->InitCheck() != B_OK) + if (path == NULL) + return B_BAD_VALUE; + + if (path->InitCheck() != B_OK) return path->InitCheck(); + status_t error = path->SetPath(kFileDevicesDir); if (error == B_OK) { char idBuffer[12];