char *subsys = (char*)ha_malloc(sizeof(char)* ref_len); strncpy(subsys, src_subsys, strlen(src_subsys)); subsys[strlen(src_subsys)] ='\0'; return subsys;
hash_value = ha_strdup(src_subsys); if (!hash_value) { cl_log(LOG_ERR, "memory allocation failed in " "generate_hash_value()\n"); return NULL;  } return hash_value;
generate_hash_value(const char *src_node, const char *src_subsys){    if(src_node == NULL || src_subsys == NULL) return NULL;    int ref_len = strlen(src_subsys) + 1;    if(strcmp("dc", src_subsys) == 0)    {	char *subsys = (char*)ha_malloc(sizeof(char)* ref_len);	strncpy(subsys, src_subsys, strlen(src_subsys));	subsys[strlen(src_subsys)] ='\0';	return subsys;    }        ref_len += strlen(src_node)+1;    char *hash_value = (char*)ha_malloc(sizeof(char)*(ref_len));    sprintf(hash_value, "%s_%s", src_node, src_subsys);    hash_value[ref_len-1] = '\0';// i want to make sure it is null terminated    cl_log(LOG_INFO, "created hash value: (%s)", hash_value);    return hash_value;}