summaryrefslogtreecommitdiff
path: root/src/libstrongswan/chunk.h
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2010-11-28 12:11:49 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2010-11-28 12:11:49 +0000
commit7b8b352039efd78338a7bf451a0550644ec8a8da (patch)
tree62e0548df49dfb3ddacc8cac4309fa10f7b42610 /src/libstrongswan/chunk.h
parent9587b8e553eda7b1b6fd48c77ebe4592e1e3532a (diff)
downloadvyos-strongswan-7b8b352039efd78338a7bf451a0550644ec8a8da.tar.gz
vyos-strongswan-7b8b352039efd78338a7bf451a0550644ec8a8da.zip
New upstream version.
Diffstat (limited to 'src/libstrongswan/chunk.h')
-rw-r--r--src/libstrongswan/chunk.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libstrongswan/chunk.h b/src/libstrongswan/chunk.h
index 5441ccf3c..f94bdfbf2 100644
--- a/src/libstrongswan/chunk.h
+++ b/src/libstrongswan/chunk.h
@@ -193,12 +193,12 @@ static inline void chunk_clear(chunk_t *chunk)
/**
* Allocate a chunk on the heap
*/
-#define chunk_alloc(bytes) ({size_t x = (bytes); chunk_create(malloc(x), x);})
+#define chunk_alloc(bytes) ({size_t x = (bytes); chunk_create(x ? malloc(x) : NULL, x);})
/**
* Allocate a chunk on the stack
*/
-#define chunk_alloca(bytes) ({size_t x = (bytes); chunk_create(alloca(x), x);})
+#define chunk_alloca(bytes) ({size_t x = (bytes); chunk_create(x ? alloca(x) : NULL, x);})
/**
* Clone a chunk on heap
@@ -208,7 +208,7 @@ static inline void chunk_clear(chunk_t *chunk)
/**
* Clone a chunk on stack
*/
-#define chunk_clonea(chunk) ({chunk_t x = (chunk); chunk_create_clone(alloca(x.len), x);})
+#define chunk_clonea(chunk) ({chunk_t x = (chunk); chunk_create_clone(x.len ? alloca(x.len) : NULL, x);})
/**
* Concatenate chunks into a chunk on heap