Merge pull request #811 from xrmx/coverity150114

Some coverity fixes
This commit is contained in:
unbit
2015-01-14 16:20:31 +01:00
6 changed files with 24 additions and 8 deletions
+2 -1
View File
@@ -738,7 +738,8 @@ void uwsgi_hooks_setns_run(struct uwsgi_string_list *l, pid_t pid, uid_t uid, gi
uwsgi_error("uwsgi_hooks_setns_run()/setns()");
exit(1);
}
close(fd);
free(procfile);
}
if (setenv("UWSGI_VASSAL_PID", pidstr, 1)) {
+5 -3
View File
@@ -931,6 +931,7 @@ void uwsgi_subscribe2(char *arg, uint8_t cmd) {
char *s2_proto = NULL;
char *s2_algo = NULL;
char *s2_backup = NULL;
struct uwsgi_buffer *ub = NULL;
if (uwsgi_kvlist_parse(arg, strlen(arg), ',', '=',
"server", &s2_server,
@@ -998,7 +999,7 @@ void uwsgi_subscribe2(char *arg, uint8_t cmd) {
s2_addr = uwsgi_str(uwsgi.sockets->name);
}
struct uwsgi_buffer *ub = uwsgi_buffer_new(uwsgi.page_size);
ub = uwsgi_buffer_new(uwsgi.page_size);
if (!ub) goto end;
// leave space for the header
ub->pos = 4;
@@ -1058,9 +1059,10 @@ void uwsgi_subscribe2(char *arg, uint8_t cmd) {
send_subscription(-1, s2_server, ub->buf, ub->pos);
uwsgi_buffer_destroy(ub);
end:
if (ub)
uwsgi_buffer_destroy(ub);
if (s2_server)
free(s2_server);
if (s2_key)
@@ -312,6 +312,7 @@ static int uwsgi_router_memcached(struct uwsgi_route *ur, char *args) {
if (!urmc->key || !urmc->addr) {
uwsgi_log("invalid route syntax: you need to specify a memcached address and key pattern\n");
free(urmc);
return -1;
}
@@ -346,6 +347,7 @@ static int uwsgi_router_memcached_store(struct uwsgi_route *ur, char *args) {
if (!urmc->key || !urmc->addr) {
uwsgi_log("invalid memcachedstore route syntax: you need to specify an address and a key\n");
free(urmc);
return -1;
}
+2
View File
@@ -310,6 +310,7 @@ static int uwsgi_router_redis(struct uwsgi_route *ur, char *args) {
if (!urrc->key || !urrc->addr) {
uwsgi_log("invalid route syntax: you need to specify a redis address and key pattern\n");
free(urrc);
return -1;
}
@@ -344,6 +345,7 @@ static int uwsgi_router_redis_store(struct uwsgi_route *ur, char *args) {
if (!urrc->key || !urrc->addr) {
uwsgi_log("invalid redisstore route syntax: you need to specify an address and a key\n");
free(urrc);
return -1;
}
+13 -3
View File
@@ -67,7 +67,10 @@ int uwsgi_routing_func_file(struct wsgi_request *wsgi_req, struct uwsgi_route *u
// static file - don't update avg_rt after request
wsgi_req->do_not_account_avg_rt = 1;
if (urfc->no_headers) goto send;
if (urfc->no_headers) {
uwsgi_buffer_destroy(ub_s);
goto send;
}
if (uwsgi_response_prepare_headers(wsgi_req, ub_s->buf, ub_s->pos)) {
uwsgi_buffer_destroy(ub_s);
@@ -138,7 +141,10 @@ int uwsgi_routing_func_sendfile(struct wsgi_request *wsgi_req, struct uwsgi_rout
// static file - don't update avg_rt after request
wsgi_req->do_not_account_avg_rt = 1;
if (urfc->no_headers) goto send;
if (urfc->no_headers) {
uwsgi_buffer_destroy(ub_s);
goto send;
}
if (uwsgi_response_prepare_headers(wsgi_req, ub_s->buf, ub_s->pos)) {
uwsgi_buffer_destroy(ub_s);
@@ -208,7 +214,10 @@ int uwsgi_routing_func_fastfile(struct wsgi_request *wsgi_req, struct uwsgi_rout
// static file - don't update avg_rt after request
wsgi_req->do_not_account_avg_rt = 1;
if (urfc->no_headers) goto send;
if (urfc->no_headers) {
uwsgi_buffer_destroy(ub_s);
goto send;
}
if (uwsgi_response_prepare_headers(wsgi_req, ub_s->buf, ub_s->pos)) {
uwsgi_buffer_destroy(ub_s);
@@ -288,6 +297,7 @@ static int uwsgi_router_file(struct uwsgi_route *ur, char *args) {
if (!urfc->filename) {
uwsgi_log("you have to specifify a filename for the \"file\" router\n");
free(urfc);
return -1;
}
-1
View File
@@ -455,7 +455,6 @@ static int uwsgi_routing_func_rpc_var(struct wsgi_request *wsgi_req, struct uwsg
if (size == 0) goto end;
if (!uwsgi_req_append(wsgi_req, ur->data4, ur->data4_len, response, size)) {
free(response);
goto end;
}
ret = UWSGI_ROUTE_NEXT;