Hi Fixes a Clang warning. If *dest is NULL, memcpy would crash.
- Lauri
>From 5811287c540683a589a7a843202e48b5a239c07c Mon Sep 17 00:00:00 2001 From: Lauri Kasanen <[email protected]> Date: Wed, 23 May 2012 17:15:54 +0300 Subject: [PATCH 02/13] memory: Prevent a possible crash in mk_pointer_to_buf Fixes a Clang warning. If *dest is NULL, memcpy would crash. Signed-off-by: Lauri Kasanen <[email protected]> --- src/mk_memory.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/mk_memory.c b/src/mk_memory.c index 967c26b..4ca9efe 100644 --- a/src/mk_memory.c +++ b/src/mk_memory.c @@ -109,6 +109,8 @@ char *mk_pointer_to_buf(mk_pointer p) char *buf; buf = mk_mem_malloc(p.len + 1); + if (!buf) return NULL; + memcpy(buf, p.data, p.len); buf[p.len] = '\0'; -- 1.7.2.1
_______________________________________________ Monkey mailing list [email protected] http://lists.monkey-project.com/listinfo/monkey
