Use calloc instead of malloc to set memory zero. 73/39373/3
authorSeunghun Lee <shiin.lee@samsung.com>
Thu, 14 May 2015 02:25:42 +0000 (11:25 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Wed, 3 Jun 2015 04:48:27 +0000 (21:48 -0700)
This patch is to avoid segmentation fault.
all of member valuable should be zero before check if valid.

Change-Id: Icc1b6a9e5be21a57d4346c9c2dbefb6cce3a0fd6
Signed-off-by: Seunghun Lee <shiin.lee@samsung.com>
src/tbm_wayland.c

index ed1de1a..1a0a541 100644 (file)
@@ -116,7 +116,7 @@ create_display(void)
        struct display *display;
     drm_magic_t magic;
 
-       display = malloc(sizeof *display);
+       display = calloc(sizeof(struct display), 1);
        if (display == NULL) {
         TBM_LOG ("[libtbm:%d] out of memory\n", getpid());
         return NULL;