fixed null pointer dereference in /join command

Command /join @/ leads to crash because jid_create("@/") returns NULL
fixed several memory leaks in command.c and jid.c
rewritten FREE_SET_NULL and GFREE_SET_NULL

NULL is valid argument for free(). Construction do {} while (0) allows
using FREE_SET_NULL as one token and force to put semicolon at the end.
separate glib allocator and stdlib malloc/free

Memory allocated by glib should be freed by g_free. Probably g_free
calls stdlib free, but in order to avoid portability issues better use
g_free as described in glib documentation.
Merge branch 'master' into nextdev
Merge remote-tracking branch 'dmitry/memleaks' into nextdev