//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include "oc_logger.h"
+#include "oic_string.h"
#include <string.h>
#include <stdlib.h>
int oc_log_set_module(oc_log_ctx_t *ctx, const char *module_name)
{
char *mn = NULL;
- size_t len = 0;
if(!ctx || !module_name)
{
}
/* Swap pointers so that module data's not erased in the event of failure: */
- len = strlen(module_name);
-
- mn = (char *)malloc(1 + len);
+ mn = OICStrdup(module_name);
if(!mn)
{
return 0;
}
- memcpy(mn, module_name, 1 + len);
-
if(!ctx->module_name)
{
free(ctx->module_name);