From 7b8b352039efd78338a7bf451a0550644ec8a8da Mon Sep 17 00:00:00 2001 From: Rene Mayrhofer Date: Sun, 28 Nov 2010 12:11:49 +0000 Subject: New upstream version. --- src/libstrongswan/chunk.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libstrongswan/chunk.h') 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 -- cgit v1.2.3