From 9530c8ffe0edc4de4fa85ba91926ee38c357221b Mon Sep 17 00:00:00 2001 From: "roberto@oneiric64" Date: Sat, 26 Nov 2011 08:10:29 +0100 Subject: [PATCH] applied riccardo's patch [2] --- subscription.c | 2 +- utils.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/subscription.c b/subscription.c index a6ac0c80..d435c917 100644 --- a/subscription.c +++ b/subscription.c @@ -78,7 +78,7 @@ struct uwsgi_subscribe_node *uwsgi_get_subscribe_node(struct uwsgi_subscribe_slo current_slot->hits++; time_t current = time(NULL); struct uwsgi_subscribe_node *node = current_slot->nodes; - while(current_slot && node) { + while(node) { // is the node alive ? if (current - node->last_check > uwsgi.subscription_tolerance) { if (node->death_mark == 0) diff --git a/utils.c b/utils.c index da282f1d..8587e6b8 100644 --- a/utils.c +++ b/utils.c @@ -1840,6 +1840,8 @@ char *uwsgi_read_fd(int fd, int *size, int add_zero) { char *uwsgi_simple_file_read(char *filename) { struct stat sb; + char *buffer; + ssize_t len; int fd = open(filename, O_RDONLY); if (fd < 0) { uwsgi_error_open(filename); @@ -1852,11 +1854,12 @@ char *uwsgi_simple_file_read(char *filename) { goto end; } - char *buffer = uwsgi_malloc(sb.st_size+1); + buffer = uwsgi_malloc(sb.st_size+1); - ssize_t len = read(fd, buffer, sb.st_size); + len = read(fd, buffer, sb.st_size); if (len != sb.st_size) { uwsgi_error("read()"); + free(buffer); close(fd); goto end; }