aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps/json_run_localhost.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/cpp/qps/json_run_localhost.cc')
-rw-r--r--test/cpp/qps/json_run_localhost.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/test/cpp/qps/json_run_localhost.cc b/test/cpp/qps/json_run_localhost.cc
index 1d394b216f..db8b2a3943 100644
--- a/test/cpp/qps/json_run_localhost.cc
+++ b/test/cpp/qps/json_run_localhost.cc
@@ -46,7 +46,7 @@ std::string as_string(const T& val) {
static void sighandler(int sig) {
const int errno_saved = errno;
- if (g_driver != NULL) g_driver->Interrupt();
+ if (g_driver != nullptr) g_driver->Interrupt();
for (int i = 0; i < kNumWorkers; ++i) {
if (g_workers[i]) g_workers[i]->Interrupt();
}
@@ -58,8 +58,8 @@ static void register_sighandler() {
memset(&act, 0, sizeof(act));
act.sa_handler = sighandler;
- sigaction(SIGINT, &act, NULL);
- sigaction(SIGTERM, &act, NULL);
+ sigaction(SIGINT, &act, nullptr);
+ sigaction(SIGTERM, &act, nullptr);
}
static void LogStatus(int status, const char* label) {
@@ -117,8 +117,14 @@ int main(int argc, char** argv) {
}
}
- delete g_driver;
- g_driver = NULL;
- for (int i = 0; i < kNumWorkers; ++i) delete g_workers[i];
+ if (g_driver != nullptr) {
+ delete g_driver;
+ }
+ g_driver = nullptr;
+ for (int i = 0; i < kNumWorkers; ++i) {
+ if (g_workers[i] != nullptr) {
+ delete g_workers[i];
+ }
+ }
GPR_ASSERT(driver_join_status == 0);
}