summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Feurle <david.feurle@sodgeit.de>2015-02-07 10:49:07 +0100
committerPhilip Withnall <philip.withnall@collabora.co.uk>2015-02-11 12:37:17 +0000
commit4723a27091166eee40b8ac5d4004df373b5736c2 (patch)
tree1e292f2879158cdd281194c846a8812c2f3ac765
parent0955ce681b99e3a7e0e6a18440a68a80d32d3ed9 (diff)
downloadlibnice-4723a27091166eee40b8ac5d4004df373b5736c2.tar.gz
stun: Use dynamic array instead of stack allocated array
Dynamic on-stack arrays are not supported in Visual Studio. This has the downside of introducing an extra memory allocation into libstun, but it’s on a debug path so should be harmless.
-rw-r--r--stun/debug.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/stun/debug.c b/stun/debug.c
index f3a55bb..3d579db 100644
--- a/stun/debug.c
+++ b/stun/debug.c
@@ -79,11 +79,12 @@ void stun_debug_bytes (const char *prefix, const void *data, size_t len)
{
size_t i;
size_t prefix_len = strlen (prefix);
- char bytes[prefix_len + 2 + (len * 2) + 1];
+ char *bytes;
if (!debug_enabled)
return;
+ bytes = malloc (prefix_len + 2 + (len * 2) + 1);
bytes[0] = 0;
strcpy (bytes, prefix);
strcpy (bytes + prefix_len, "0x");
@@ -92,6 +93,7 @@ void stun_debug_bytes (const char *prefix, const void *data, size_t len)
sprintf (bytes + prefix_len + 2 + (i * 2), "%02x", ((const unsigned char *)data)[i]);
stun_debug ("%s", bytes);
+ free (bytes);
}