From 8d03d8b95976b0d819722b49a737be657ab1bc47 Mon Sep 17 00:00:00 2001 From: icy17 <1061499390@qq.com> Date: Wed, 10 Apr 2024 19:07:59 +0800 Subject: [PATCH] Fix potential Null pointer dereference in extract_vbucket_conf.cc --- apps/evmc/extract_vbucket_conf.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/evmc/extract_vbucket_conf.cc b/apps/evmc/extract_vbucket_conf.cc index 16faf1c58..9a3004b55 100644 --- a/apps/evmc/extract_vbucket_conf.cc +++ b/apps/evmc/extract_vbucket_conf.cc @@ -45,7 +45,13 @@ void GetVbucketConf::OnHttpReqDone(struct evhttp_request* req, void* arg) { int GetVbucketConf::GetRemoteVbucketConf(const std::string& conf_addr, std::string& context) { evpp::httpc::URLParser url(conf_addr); struct event_base* base = event_base_new(); + if (base == NULL) { + return -1; + } struct evhttp_connection* conn = evhttp_connection_base_new(base, nullptr, url.host.c_str(), url.port); + if (conn == NULL) { + return -1; + } HttpReqDoneArg arg; arg.event = base; arg.retstr = &context;