mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:27:43 +00:00
Kernel: Replace bare new in Custody::create() with adopt_ref_if_nonnull
This commit is contained in:
parent
956314f0a1
commit
5dc5f31f76
1 changed files with 2 additions and 2 deletions
|
@ -22,11 +22,11 @@ class Custody : public RefCounted<Custody> {
|
||||||
public:
|
public:
|
||||||
static KResultOr<NonnullRefPtr<Custody>> create(Custody* parent, const StringView& name, Inode& inode, int mount_flags)
|
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)
|
if (!custody)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
|
|
||||||
return adopt_ref(*custody);
|
return custody.release_nonnull();
|
||||||
}
|
}
|
||||||
|
|
||||||
~Custody();
|
~Custody();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue