From f674af397261db19b448eb91572405013b809f3f Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Tue, 7 Jul 2015 15:46:04 +0200 Subject: [PATCH] Don't touch rss if it hasn't been initialized in get_memusage Followup for Coverity CID 1308302 --- core/logging.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/logging.c b/core/logging.c index f5b01590..b4dbcb02 100644 --- a/core/logging.c +++ b/core/logging.c @@ -748,10 +748,11 @@ void get_memusage(uint64_t * rss, uint64_t * vsz) { i = fscanf(procfile, "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %llu %lld", (unsigned long long *) vsz, (unsigned long long *) rss); if (i != 2) { uwsgi_log("warning: invalid record in /proc/self/stat\n"); + } else { + *rss = *rss * uwsgi.page_size; } fclose(procfile); } - *rss = *rss * uwsgi.page_size; #elif defined(__CYGWIN__) // same as Linux but rss is not in pages... FILE *procfile;