Factorisation of the unix socket path computation
The code that was appearing 3 times, doing the same thing
is factorized in a single function.
A check to a not possible error is removed.
Some memory clean-up is added to avoid a memory leak.
This commit prepares to multi-user because the path of the
unix sockets may depend of the user. Then having a central
place to perform this computation is simplier.
Change-Id: I88a4df4951bd240aef82e6960b9f91e6e4f1067d
Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>