From 9474750bdf9a92e6d9154c2010dc00583da9e9b0 Mon Sep 17 00:00:00 2001 From: canyie Date: Sun, 11 Sep 2022 23:33:06 +0800 Subject: [PATCH] Close fd of erroneous daemon socket connections --- native/src/core/daemon.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/native/src/core/daemon.cpp b/native/src/core/daemon.cpp index e10a122cf..b30a73650 100644 --- a/native/src/core/daemon.cpp +++ b/native/src/core/daemon.cpp @@ -447,12 +447,15 @@ int connect_daemon(int req, bool create) { break; case MainResponse::ERROR: LOGE("Daemon error\n"); + close(fd); return -1; case MainResponse::ROOT_REQUIRED: LOGE("Root is required for this operation\n"); + close(fd); return -1; case MainResponse::ACCESS_DENIED: LOGE("Access denied\n"); + close(fd); return -1; default: __builtin_unreachable();