From 87b878a09e5d160de76325e8960065d6a6bd8fd7 Mon Sep 17 00:00:00 2001 From: yancey Date: Sat, 22 Jul 2023 14:31:17 -0400 Subject: [PATCH] fix stack-use-after-scope reported by sanitizer --- main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index d40ca56..d2d0802 100644 --- a/main.cpp +++ b/main.cpp @@ -40,19 +40,19 @@ int main(int argc, char *argv[]) { pre_process_arg(argc, argv); + ev_signal signal_watcher_sigpipe; + ev_signal signal_watcher_sigterm; + ev_signal signal_watcher_sigint; + if (program_mode == client_mode) { struct ev_loop *loop = ev_default_loop(0); #if !defined(__MINGW32__) - ev_signal signal_watcher_sigpipe; ev_signal_init(&signal_watcher_sigpipe, sigpipe_cb, SIGPIPE); ev_signal_start(loop, &signal_watcher_sigpipe); #endif - - ev_signal signal_watcher_sigterm; ev_signal_init(&signal_watcher_sigterm, sigterm_cb, SIGTERM); ev_signal_start(loop, &signal_watcher_sigterm); - ev_signal signal_watcher_sigint; ev_signal_init(&signal_watcher_sigint, sigint_cb, SIGINT); ev_signal_start(loop, &signal_watcher_sigint); } else {