mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 17:58:18 +03:00
Kernel: Replace bare new in Custody::create() with adopt_ref_if_nonnull
This commit is contained in:
parent
956314f0a1
commit
5dc5f31f76
Notes:
sideshowbarker
2024-07-18 18:14:54 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/5dc5f31f76a Pull-request: https://github.com/SerenityOS/serenity/pull/7077
@ -22,11 +22,11 @@ class Custody : public RefCounted<Custody> {
|
||||
public:
|
||||
static KResultOr<NonnullRefPtr<Custody>> create(Custody* parent, const StringView& name, Inode& inode, int mount_flags)
|
||||
{
|
||||
auto custody = new Custody(parent, name, inode, mount_flags);
|
||||
auto custody = adopt_ref_if_nonnull(new Custody(parent, name, inode, mount_flags));
|
||||
if (!custody)
|
||||
return ENOMEM;
|
||||
|
||||
return adopt_ref(*custody);
|
||||
return custody.release_nonnull();
|
||||
}
|
||||
|
||||
~Custody();
|
||||
|
Loading…
Reference in New Issue
Block a user