[krh/wayland/next 1/5] connection: Don't call memcpy with null pointer.

John Kåre Alsaker john.kare.alsaker at gmail.com
Fri Oct 12 02:28:24 PDT 2012


---
 src/connection.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index 8497670..58b150b 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -486,12 +486,12 @@ wl_closure_vmarshal(struct wl_object *sender,
 				goto err;
 			*p++ = length;
 
-			if (length > 0)
+			if (length > 0) {
+				memcpy(p, s, length);
 				*sp = (const char *) p;
-			else
+			} else
 				*sp = NULL;
 
-			memcpy(p, s, length);
 			memset((char *) p + length, 0, aligned - length);
 			p += aligned / sizeof *p;
 			break;
-- 
1.7.12.2



More information about the wayland-devel mailing list