diff --git a/core/fsmon.c b/core/fsmon.c index 8a306783..f02043e6 100644 --- a/core/fsmon.c +++ b/core/fsmon.c @@ -38,6 +38,7 @@ void uwsgi_fsmon_setup() { char *space = strchr(copy, ' '); if (!space) { uwsgi_log("[uwsgi-fsmon] invalid syntax: \"%s\"\n", usl->value); + free(copy); goto next; } *space = 0; diff --git a/core/io.c b/core/io.c index 8db4d433..fe720098 100644 --- a/core/io.c +++ b/core/io.c @@ -364,6 +364,7 @@ static char *uwsgi_scheme_data(char *url, size_t *size, int add_zero) { } } } + close(fd); return buffer; } diff --git a/core/snmp.c b/core/snmp.c index b2ed383f..5cc34ff9 100644 --- a/core/snmp.c +++ b/core/snmp.c @@ -305,6 +305,7 @@ static uint8_t snmp_int_to_snmp(uint64_t snmp_val, uint8_t oid_type, uint8_t * b uint8_t tlen; int i, j; uint8_t *ptr = (uint8_t *) & snmp_val; + int32_t val32 = (int32_t) snmp_val; // check for counter, counter64 or gauge @@ -316,7 +317,6 @@ static uint8_t snmp_int_to_snmp(uint64_t snmp_val, uint8_t oid_type, uint8_t * b } else { tlen = 4; - int32_t val32 = (int32_t) snmp_val; ptr = (uint8_t *) &val32; } diff --git a/core/utils.c b/core/utils.c index 2451d368..48071ba8 100644 --- a/core/utils.c +++ b/core/utils.c @@ -3419,7 +3419,11 @@ int uwsgi_write_intfile(char *filename, int n) { uwsgi_error_open(filename); exit(1); } - if (fprintf(pidfile, "%d\n", n) <= 0 || ferror(pidfile) || fclose(pidfile)) { + if (fprintf(pidfile, "%d\n", n) <= 0 || ferror(pidfile)) { + fclose(pidfile); + return -1; + } + if (fclose(pidfile)) { return -1; } return 0; @@ -4228,6 +4232,7 @@ void uwsgi_envdir(char *edir) { free(content); } + closedir(d); } void uwsgi_envdirs(struct uwsgi_string_list *envdirs) { diff --git a/plugins/rrdtool/rrdtool.c b/plugins/rrdtool/rrdtool.c index ff39f8b1..a73eda1c 100644 --- a/plugins/rrdtool/rrdtool.c +++ b/plugins/rrdtool/rrdtool.c @@ -104,8 +104,8 @@ static void rrdtool_post_init() { exit(1); } created++; - free(filename); } + free(filename); um = um->next; } uwsgi_rwunlock(uwsgi.metrics_lock);