diff --git a/core/spooler.c b/core/spooler.c index 713cd829..2245ecee 100644 --- a/core/spooler.c +++ b/core/spooler.c @@ -374,12 +374,12 @@ char *uwsgi_spool_request(struct wsgi_request *wsgi_req, char *buf, size_t len, clear: - if (filename) free(filename); uwsgi_unlock(uspool->lock); uwsgi_error("uwsgi_spool_request()/write()"); if (unlink(filename)) { uwsgi_error("uwsgi_spool_request()/unlink()"); } + free(filename); // unlock the file too close(fd); return NULL; diff --git a/core/ssl.c b/core/ssl.c index 1d7a65fa..c9c18452 100644 --- a/core/ssl.c +++ b/core/ssl.c @@ -181,6 +181,7 @@ char *uwsgi_write_pem_to_file(char *name, char *buf, size_t len, char *ext) { uwsgi_log("unable to write pem data in file %s\n", filename); uwsgi_error("uwsgi_write_pem_to_file()/write()"); free(filename); + close(fd); return NULL; } @@ -304,6 +305,10 @@ SSL_CTX *uwsgi_ssl_new_server_context(char *name, char *crt, char *key, char *ci SSL_CTX_set_verify_depth(ctx, 1); if (uwsgi.ssl_tmp_dir && !uwsgi_starts_with(client_ca, strlen(client_ca), "-----BEGIN ", 11)) { + if (!name) { + SSL_CTX_free(ctx); + return NULL; + } client_ca = uwsgi_write_pem_to_file(name, client_ca, strlen(client_ca), ".ca"); if (!client_ca) { SSL_CTX_free(ctx); diff --git a/plugins/logpipe/logpipe.c b/plugins/logpipe/logpipe.c index 9e14fad6..859003ef 100644 --- a/plugins/logpipe/logpipe.c +++ b/plugins/logpipe/logpipe.c @@ -29,6 +29,10 @@ static ssize_t uwsgi_pipe_logger(struct uwsgi_logger *ul, char *message, size_t else { // child setsid(); + if (setsid() < 0) { + uwsgi_error("setsid()"); + exit(1); + } close(pipefd[1]); dup2(pipefd[0], STDIN_FILENO); close(pipefd[0]);