diff options
author | Gurucharan Shetty <gshetty@nicira.com> | 2014-02-14 08:12:32 -0800 |
---|---|---|
committer | Gurucharan Shetty <gshetty@nicira.com> | 2014-02-14 08:46:05 -0800 |
commit | 315ea327a63195d86082eecd502b830a3b2ece5e (patch) | |
tree | 57c63a95bc1a4f5a2fa1c6a46f6c487b89faade7 /lib/entropy.c | |
parent | f4c340e1d996704ed81223217b172dbac3f045ac (diff) | |
download | openvswitch-315ea327a63195d86082eecd502b830a3b2ece5e.tar.gz |
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 <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/entropy.c')
-rw-r--r-- | lib/entropy.c | 4 |
1 files changed, 1 insertions, 3 deletions
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); |