From 88e01a1aca8663d42b7852f0ad686849945b9e07 Mon Sep 17 00:00:00 2001 From: David Smith Date: Mon, 9 Oct 2017 10:51:42 -0500 Subject: [PATCH] Do better cleanup when the web server gets an error. * httpd/backends.cxx (generate_module): Be sure to cleanup the posix_span_file_actions, even if we get an error. --- httpd/backends.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/httpd/backends.cxx b/httpd/backends.cxx index 2c2574f57..69e50ae56 100644 --- a/httpd/backends.cxx +++ b/httpd/backends.cxx @@ -132,13 +132,17 @@ local_backend:: generate_module(const struct client_request_data *, // If stap_spawn() failed, no need to wait. if (pid == -1) { + rc = errno; clog << "Error in spawn: " << strerror(errno) << endl; - return errno; + (void)posix_spawn_file_actions_destroy(&actions); + return rc; } // Wait on the spawned process to finish. rc = stap_waitpid(0, pid); if (rc < 0) { // stap_waitpid() failed + clog << "waitpid failed: " << strerror(errno) << endl; + (void)posix_spawn_file_actions_destroy(&actions); return rc; } -- 2.43.5