clients: Simplify memory allocation with xzalloc()
authorBryce Harrington <bryce@osg.samsung.com>
Fri, 19 Jun 2015 23:12:22 +0000 (16:12 -0700)
committerBryce Harrington <bryce@osg.samsung.com>
Fri, 10 Jul 2015 07:15:42 +0000 (00:15 -0700)
commitda9d8fa3e46cc035f94be6441452a7738327ecf0
tree544e8636ecc7e3c6b4d6b62ee3b78ea68d9ac827
parent430aee1c23a641cf3227bcde08419458ef2ea252
clients: Simplify memory allocation with xzalloc()

It is redundant to check x*alloc's return value for null pointers, since
they are guaranteed to either return non-NULL or terminate the program.

In cases where we memset the malloc'd memory to 0, we can more
efficiently use the xzalloc() routine.  zalloc looks for opportunities
to return memory chunks that have already been zero'd out, so it can
provide better performance.

This patch addresses this warning, reported by Denis Denisov:

  [clients/window.c:1164] -> [clients/window.c:1166]: (warning) Possible
  null pointer dereference: surface - otherwise it is redundant to check
  it against null.

  [clients/window.c:4513] -> [clients/window.c:4514]: (warning) Possible
  null pointer dereference: surface - otherwise it is redundant to check
  it against null.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
clients/window.c