connection: Don't call memcpy with null pointer.
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Fri, 12 Oct 2012 09:28:24 +0000 (11:28 +0200)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 16 Oct 2012 15:12:38 +0000 (11:12 -0400)
src/connection.c

index fdc9309..f2ef230 100644 (file)
@@ -517,12 +517,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;