From 9bdddd713af925a4be161f65e5fd66eccc8bd1eb Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Thu, 23 Mar 2017 16:07:51 -0700 Subject: [PATCH] init: Remove superfluous error check new doesn't return nullptr in C++, so there is no need to check for it. Test: Boot bullhead Change-Id: I666afb1ba7082dd8d5b9911605b7e20a5561b49e --- init/service.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/init/service.cpp b/init/service.cpp index 35aaa563a..c8d1cb166 100644 --- a/init/service.cpp +++ b/init/service.cpp @@ -889,15 +889,10 @@ Service* ServiceManager::MakeExecOneshotService(const std::vector& } } - std::unique_ptr svc_p(new Service(name, "default", flags, uid, gid, supp_gids, - no_capabilities, namespace_flags, seclabel, - str_args)); - if (!svc_p) { - LOG(ERROR) << "Couldn't allocate service for exec of '" << str_args[0] << "'"; - return nullptr; - } + auto svc_p = std::make_unique(name, "default", flags, uid, gid, supp_gids, + no_capabilities, namespace_flags, seclabel, str_args); Service* svc = svc_p.get(); - services_.push_back(std::move(svc_p)); + services_.emplace_back(std::move(svc_p)); return svc; }