ecore_wayland: add null check after realloc to avoid dereferencing a null pointer 20/49420/1
authorGwanglim Lee <gl77.lee@samsung.com>
Tue, 13 Oct 2015 05:56:19 +0000 (14:56 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Tue, 13 Oct 2015 05:56:19 +0000 (14:56 +0900)
Change-Id: Ie903e619cb990ecaf4cbfc028d4c79548b39891f

src/lib/ecore_wayland/ecore_wl.c

index 5d4007c..1f97462 100644 (file)
@@ -1006,7 +1006,8 @@ static void find_keycode(struct xkb_keymap *keymap, xkb_keycode_t key, void *dat
           {
              found_keycodes->num_keycodes++;
              found_keycodes->keycodes = realloc(found_keycodes->keycodes, sizeof(int) * found_keycodes->num_keycodes);
-             found_keycodes->keycodes[found_keycodes->num_keycodes - 1] = key;
+             if (found_keycodes->keycodes)
+               found_keycodes->keycodes[found_keycodes->num_keycodes - 1] = key;
           }
      }
 }