Fixed multiple memory leaks identified using valgrind

Change-Id: Ia507b072d113153c4fe7f870877e2d032968b930
ALLJOYN-1752 Fixed possible buffer overflow error

original code assumed that the buffer size specified for stcncat
worked like the buffer size when doing snprintf by limiting the
number of bytes copied to the buffer. The code as it was writen
could copy past the buffer.

Change-Id: Ie40e733d95e4786667307ad9de4b109efe7d0075