core/exception: avoid null pointer dereference in uwsgi_exception_run_handlers

If wsgi_req is NULL and uwsgi.reload_on_exception is True

Reported by Coverity as CID #989244.
This commit is contained in:
Riccardo Magliocchetti
2013-03-03 19:06:59 +01:00
parent eae00a5c77
commit 07bd3f5df0
+4 -7
View File
@@ -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++;