db: Remove unneeded cleanup section
cli: fix incorrect BuxtonKey memory free

Not every return path in cli_set_value frees key,
also just free call is not enough for BuxtonKey, due it's composite
structure. Callback free_buxton_key which are registered for
_cleanup_buxton_key_ releases complete BuxtonKey structure.

cli_get_value didn't release BuxtonKey's memory at all.

Signed-off-by: Alexey Perevalov <a.perevalov@samsung.com>
daemon: fix memmove in del_pollfd

Size of tail part was based on size of pointer type, not bool.

Signed-off-by: Alexey Perevalov <a.perevalov@samsung.com>
lbuxton: Add check for buxton socket path name length

Buxton's socket name could be obtained from environmental variables and
from config, end user could specify really long name. To prevent memory
corruption in case of missing /0 character and to prevent logic error,
it's better to add check for length of buxton's socket name in place of
its usage.

Signed-off-by: Alexey Perevalov <a.perevalov@samsung.com>
core: Eliminate dead code
cli: Ensure BuxtonClient is free'd for non-direct mode

BuxtonClient can either be managed within a control struct, or "direct"
mode, or in the normal wire mode. This commit ensures that we correctly
clean up the allocated BuxtonClient for use with the wire protocol.

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
cli: Implement version (--version,-v) option

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
cli: Fix segfault due to uninitialized client

We now ensure we have an initialized (NULL) BuxtonClient before we ever use
it, and only attempt to close the connection in instances where it is
appropriate, i.e. a new BuxtonClient is allocated.

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
Release buxton v2
cli: Abort if asprintf fails

There's really nothing graceful we can do here. If you can't asprintf,
you have bigger problems already.

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
demo: Remove CSD's from Gtk demo

Client Side Decorations are only supported under GNOME3.10 and beyond,
and look entirely abnormal on any other desktop.

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
demo: Prevent double-free in Gtk demo

In keeping with the recent buxton wire API change that ensures all resources
are free'd upon closing a connection, the demo now ensures that we only
cleanup our BuxtonClient if its successfully connected within its lifetime.

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
data: Fix typo in buxton.conf

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
Add key-related memory mgmt

Adds auto free'ing of BuxtonKeys, so client no
longer needs to. Keys are free'd on buxton_close,
so if client-server connection is not properly closed,
a mem leak can remain
libbuxton: Don't use printf after memory allocation failure
Merge remote-tracking branch 'upstream/master'