From 315ea327a63195d86082eecd502b830a3b2ece5e Mon Sep 17 00:00:00 2001 From: Gurucharan Shetty Date: Fri, 14 Feb 2014 08:12:32 -0800 Subject: util: Pre-allocate buffer for ovs_lasterror_to_string(). This lets us call ovs_lasterror_to_string() and not having to do an extra call of LocalFree() on the returned string. Signed-off-by: Gurucharan Shetty Acked-by: Ben Pfaff --- lib/entropy.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/entropy.c') diff --git a/lib/entropy.c b/lib/entropy.c index 53f7e72a6..f9808553d 100644 --- a/lib/entropy.c +++ b/lib/entropy.c @@ -60,10 +60,8 @@ get_entropy(void *buffer, size_t n) CryptAcquireContext(&crypt_prov, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT); if (!CryptGenRandom(crypt_prov, n, buffer)) { - char *msg_buf = ovs_lasterror_to_string(); + VLOG_ERR("CryptGenRandom: read error (%s)", ovs_lasterror_to_string()); error = EINVAL; - VLOG_ERR("CryptGenRandom: read error (%s)", msg_buf); - LocalFree(msg_buf); } CryptReleaseContext(crypt_prov, 0); -- cgit v1.2.1