server: fix potential memleak and NULL deref
server: fix potential memleak and NULL deref

If for some reason that errno is neither value (ENOMEM or
EINVAL), then prior to this patch, there would be a NULL
deref in wl_closure_lookup(...) at the "else if" conditional
when closure == NULL. Also, closure might not be NULL but still
fall into the block due to the wl_closure_lookup < 0 condition...
in that case, we need to destroy the closure to avoid a memory
leak.

Currently, wl_connection_demarshal only sets errno to ENOMEM
or EINVAL... we've already checked for ENOMEM so remove check
for EINVAL (just assume it).  Also, call wl_closure_destroy(...)
unconditionally in the "else if" block (assume it can handle
NULL closure, too, which it does right now).

Signed-off-by: U. Artie Eoff <32aece0d55055227b44d04b7d0051cf3d04ee871@intel.com>

sir-murray/wayland,mchalupa/wayland,tulcod/wayland,mchalupa/wayland,eyolfson/wayland,bitfactor/wayland,abooij/wayland,abooij/wayland,bitfactor/wayland,bitfactor/wayland,mchalupa/wayland,sir-murray/wayland,sir-murray/wayland,eyolfson/wayland,tulcod/wayland,abooij/wayland,tulcod/wayland,eyolfson/wayland