diff --git a/core/alarm.c b/core/alarm.c index 46c53e66..2a60423a 100644 --- a/core/alarm.c +++ b/core/alarm.c @@ -201,11 +201,13 @@ static void uwsgi_alarm_thread_loop(struct uwsgi_thread *ut) { long ptr = 0; memcpy(&ptr, buf, sizeof(long)); struct uwsgi_alarm_instance *uai = (struct uwsgi_alarm_instance *) ptr; - if (!uai) return; + if (!uai) + break; uwsgi_alarm_run(uai, msg, msg_size); } } } + free(buf); } // initialize alarms, instances and log regexps diff --git a/core/exceptions.c b/core/exceptions.c index fdaf0a04..b67ba8df 100644 --- a/core/exceptions.c +++ b/core/exceptions.c @@ -316,12 +316,11 @@ static void uwsgi_exception_run_handlers(struct uwsgi_buffer *ub) { void uwsgi_manage_exception(struct wsgi_request *wsgi_req,int catch) { - int do_exit = 0; + int do_exit = uwsgi.reload_on_exception; - if (uwsgi.reload_on_exception) { - do_exit = 1; - goto check_catch; - } + if (!wsgi_req) goto log2; + + if (do_exit) goto check_catch; if (wsgi_req && uwsgi.exception_handlers_instance) { struct uwsgi_buffer *ehi = uwsgi_exception_handler_object(wsgi_req); @@ -331,8 +330,6 @@ void uwsgi_manage_exception(struct wsgi_request *wsgi_req,int catch) { } } - if (!wsgi_req) goto log2; - uwsgi.workers[uwsgi.mywid].cores[wsgi_req->async_id].exceptions++; uwsgi_apps[wsgi_req->app_id].exceptions++; @@ -452,13 +449,15 @@ static void uwsgi_exception_handler_thread_loop(struct uwsgi_thread *ut) { long ptr = 0; memcpy(&ptr, buf, sizeof(long)); struct uwsgi_exception_handler_instance *uehi = (struct uwsgi_exception_handler_instance *) ptr; - if (!uehi) return; + if (!uehi) + break; if (uehi->handler->func(uehi, msg, msg_size)) { uwsgi_log("[uwsgi-exception] error running the handler \"%s\" args: \"%s\"\n", uehi->handler->name, uehi->arg ? uehi->arg : ""); } } } } + free(buf); } void uwsgi_exception_setup_handlers() { @@ -473,8 +472,11 @@ void uwsgi_exception_setup_handlers() { struct uwsgi_exception_handler *ueh = uwsgi_exception_handler_by_name(handler); if (!ueh) { uwsgi_log("unable to find exception handler: %s\n", handler); + free(handler); exit(1); } + free(handler); + struct uwsgi_exception_handler_instance *uehi = uwsgi_calloc(sizeof(struct uwsgi_exception_handler_instance)); uehi->handler = ueh; if (colon) { diff --git a/core/ini.c b/core/ini.c index 5fc9fcd0..faed46ca 100644 --- a/core/ini.c +++ b/core/ini.c @@ -54,7 +54,7 @@ char *ini_get_key(char *key) { return ptr; } -char *ini_get_line(char *ini, off_t size) { +char *ini_get_line(char *ini, size_t size) { off_t i; char *ptr = ini; diff --git a/core/static.c b/core/static.c index 5d318061..e263f220 100644 --- a/core/static.c +++ b/core/static.c @@ -148,6 +148,7 @@ static time_t parse_http_date(char *date, uint16_t len) { case 'N': hdtm.tm_mon = 10; + break; case 'D': hdtm.tm_mon = 11; diff --git a/core/subscription.c b/core/subscription.c index ad7f1788..3cf9926c 100644 --- a/core/subscription.c +++ b/core/subscription.c @@ -767,7 +767,7 @@ void uwsgi_subscribe2(char *arg, uint8_t cmd) { return; } - if (!s2_server && !s2_key) goto end; + if (!s2_server || !s2_key) goto end; if (s2_check) { if (uwsgi_file_exists(s2_check)) goto end; diff --git a/core/yaml.c b/core/yaml.c index 14179256..c69c49c4 100644 --- a/core/yaml.c +++ b/core/yaml.c @@ -61,7 +61,7 @@ int yaml_get_depth(char *line) { return depth; } -char *yaml_get_line(char *yaml, off_t size) { +char *yaml_get_line(char *yaml, size_t size) { off_t i; char *ptr = yaml; diff --git a/plugins/http/keepalive.c b/plugins/http/keepalive.c index 1396521a..48164463 100644 --- a/plugins/http/keepalive.c +++ b/plugins/http/keepalive.c @@ -152,12 +152,9 @@ int http_response_parse(struct http_session *hr, struct uwsgi_buffer *ub, size_t } } - hr->session.can_keepalive = hr->session.can_keepalive; - } - else if (hr->session.can_keepalive) { -#else - if (hr->session.can_keepalive) { + } else #endif + if (hr->session.can_keepalive) { if (uhttp.auto_chunked) { char cr = buf[len-2]; char nl = buf[len-1]; diff --git a/plugins/router_http/router_http.c b/plugins/router_http/router_http.c index 87763dc1..6065b485 100644 --- a/plugins/router_http/router_http.c +++ b/plugins/router_http/router_http.c @@ -16,7 +16,7 @@ static int uwsgi_routing_func_http(struct wsgi_request *wsgi_req, struct uwsgi_r if (ur->data3_len) { char **subject = (char **) (((char *)(wsgi_req))+ur->subject); uint16_t *subject_len = (uint16_t *) (((char *)(wsgi_req))+ur->subject_len); - struct uwsgi_buffer *ub_url = uwsgi_routing_translate(wsgi_req, ur, *subject, *subject_len, ur->data3, ur->data3_len); + ub_url = uwsgi_routing_translate(wsgi_req, ur, *subject, *subject_len, ur->data3, ur->data3_len); if (!ub_url) return UWSGI_ROUTE_BREAK; } diff --git a/proto/base.c b/proto/base.c index f46da7f1..6b424db0 100644 --- a/proto/base.c +++ b/proto/base.c @@ -155,7 +155,6 @@ end: struct uwsgi_buffer *uwsgi_proto_base_cgi_prepare_headers(struct wsgi_request *wsgi_req, char *s, uint16_t sl) { struct uwsgi_buffer *ub = uwsgi_buffer_new(8 + sl + 2); - ub = uwsgi_buffer_new(8 + sl + 2); if (uwsgi_buffer_append(ub, "Status: ", 8)) goto end; if (uwsgi_buffer_append(ub, s, sl)) goto end; if (uwsgi_buffer_append(ub, "\r\n", 2)) goto end;