version 1.1.1.1.2.10, 2012/04/27 16:02:16
|
version 1.1.1.1.2.11, 2012/04/27 16:17:11
|
Line 400 mqtt_subCopy(mqtt_subscr_t * __restrict dst, mqtt_subs
|
Line 400 mqtt_subCopy(mqtt_subscr_t * __restrict dst, mqtt_subs
|
return NULL; |
return NULL; |
|
|
if (src->sub_topic.msg_base) { |
if (src->sub_topic.msg_base) { |
dst->sub_topic.msg_base = malloc(src->sub_topic.msg_len); | dst->sub_topic.msg_base = malloc(src->sub_topic.msg_len + 1); |
if (!dst->sub_topic.msg_base) { |
if (!dst->sub_topic.msg_base) { |
LOGERR; |
LOGERR; |
memset(dst, 0, sizeof(mqtt_subscr_t)); |
memset(dst, 0, sizeof(mqtt_subscr_t)); |
return NULL; |
return NULL; |
} else { |
} else { |
dst->sub_topic.msg_len = src->sub_topic.msg_len; |
dst->sub_topic.msg_len = src->sub_topic.msg_len; |
|
((char*) dst->sub_topic.msg_base)[dst->sub_topic.msg_len] = 0; |
memcpy(dst->sub_topic.msg_base, src->sub_topic.msg_base, |
memcpy(dst->sub_topic.msg_base, src->sub_topic.msg_base, |
dst->sub_topic.msg_len); |
dst->sub_topic.msg_len); |
} |
} |
} |
} |
if (src->sub_value.msg_base) { |
if (src->sub_value.msg_base) { |
dst->sub_value.msg_base = malloc(src->sub_value.msg_len); | dst->sub_value.msg_base = malloc(src->sub_value.msg_len + 1); |
if (!dst->sub_value.msg_base) { |
if (!dst->sub_value.msg_base) { |
LOGERR; |
LOGERR; |
if (dst->sub_topic.msg_base) |
if (dst->sub_topic.msg_base) |
Line 421 mqtt_subCopy(mqtt_subscr_t * __restrict dst, mqtt_subs
|
Line 422 mqtt_subCopy(mqtt_subscr_t * __restrict dst, mqtt_subs
|
return NULL; |
return NULL; |
} else { |
} else { |
dst->sub_value.msg_len = src->sub_value.msg_len; |
dst->sub_value.msg_len = src->sub_value.msg_len; |
|
((char*) dst->sub_value.msg_base)[dst->sub_value.msg_len] = 0; |
memcpy(dst->sub_value.msg_base, src->sub_value.msg_base, |
memcpy(dst->sub_value.msg_base, src->sub_value.msg_base, |
dst->sub_value.msg_len); |
dst->sub_value.msg_len); |
} |
} |