aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/core/prefix.cc
diff options
context:
space:
mode:
authorAngelo Mantellini <angelo.mantellini@cisco.com>2020-03-31 11:10:00 +0000
committerGerrit Code Review <gerrit@fd.io>2020-03-31 11:10:00 +0000
commit23c3bb7400839b664096ad5e16a2346386109bda (patch)
treed1999acef9f91cd25db9b7c63fd2963cd7ba0e57 /libtransport/src/core/prefix.cc
parentd46e59824bd3fc67abe7bd725965aa454942d640 (diff)
parent3718e549ee31ac764b327bbf3d6e51dd7e224b46 (diff)
Merge "[HICN-581] update hicn stack to support windows, again"
Diffstat (limited to 'libtransport/src/core/prefix.cc')
-rw-r--r--libtransport/src/core/prefix.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/libtransport/src/core/prefix.cc b/libtransport/src/core/prefix.cc
index 59898ab70..30f780461 100644
--- a/libtransport/src/core/prefix.cc
+++ b/libtransport/src/core/prefix.cc
@@ -226,7 +226,7 @@ Name Prefix::getRandomName() const {
ip_prefix_.len;
size_t size = (size_t)ceil((float)addr_len / 8.0);
- uint8_t buffer[size];
+ uint8_t *buffer = (uint8_t *) malloc(sizeof(uint8_t) * size);
RAND_bytes(buffer, size);
@@ -237,6 +237,7 @@ Name Prefix::getRandomName() const {
name_ip_buffer[i] = buffer[j];
j++;
}
+ free(buffer);
return Name(ip_prefix_.family, (uint8_t *)&name_ip);
}