Cleaned up some static initialization and casting errors in one function.
Cleaned up function to ensure that different scopes within the stack don't
act negatively on eachother by malloc'ing space for each caller to
obtain their own copy of the address.
Change-Id: I7ebdfde0fb6edbbe57f0d52b541fc252e7509b17
Signed-off-by: Joseph Morrow <joseph.l.morrow@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/541
Reviewed-by: Erich Keane <erich.keane@intel.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>