From a90df70af5e20d5af156fd714546428739cc8eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 19 Feb 2017 18:21:00 +0100 Subject: [PATCH] bfs: Fixed leaking cookie regression. * Introduced with the last commit. --- src/add-ons/kernel/file_systems/bfs/Attribute.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/add-ons/kernel/file_systems/bfs/Attribute.cpp b/src/add-ons/kernel/file_systems/bfs/Attribute.cpp index 93c343446a..3347e6414e 100644 --- a/src/add-ons/kernel/file_systems/bfs/Attribute.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Attribute.cpp @@ -3,7 +3,8 @@ * This file may be used under the terms of the MIT License. */ -//! connection between pure inode and kernel_interface attributes + +//! Connection between pure inode and kernel_interface attributes. #include "Attribute.h" @@ -120,17 +121,17 @@ Attribute::Create(const char* name, type_code type, int openMode, attr_cookie** _cookie) { status_t status = CheckAccess(name, openMode); - if (status < B_OK) + if (status != B_OK) return status; - attr_cookie* cookie = new(std::nothrow) attr_cookie; - if (cookie == NULL) - RETURN_ERROR(B_NO_MEMORY); - bool exists = Get(name) == B_OK; if (exists && (openMode & O_EXCL) != 0) return B_FILE_EXISTS; + attr_cookie* cookie = new(std::nothrow) attr_cookie; + if (cookie == NULL) + RETURN_ERROR(B_NO_MEMORY); + fName = name; // initialize the cookie