From 21bcacebba21bfe1ec003069b9c96e3a6ec30e10 Mon Sep 17 00:00:00 2001 From: Per Nilsson Date: Mon, 20 Apr 2015 15:53:33 +0200 Subject: [PATCH] win: fix of double free in uv_uptime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/libuv/libuv/pull/324 Reviewed-By: Saúl Ibarra Corretgé --- src/win/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/win/util.c b/src/win/util.c index 8df9362c..0a7217cf 100644 --- a/src/win/util.c +++ b/src/win/util.c @@ -534,14 +534,14 @@ int uv_uptime(double* uptime) { return uv_translate_sys_error(result); } - uv__free(malloced_buffer); - buffer_size *= 2; /* Don't let the buffer grow infinitely. */ if (buffer_size > 1 << 20) { goto internalError; } + uv__free(malloced_buffer); + buffer = malloced_buffer = (BYTE*) uv__malloc(buffer_size); if (malloced_buffer == NULL) { *uptime = 0;