X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_eal%2Fcommon%2Feal_common_trace_ctf.c;h=33e419aac7fb5d691325ea5f68ed6fb33115ed1f;hb=e863fe3a13da89787fdf3b5c590101a3c0f10af6;hp=174cdac1b0ba14701025e22a7e20ee7ff44eda87;hpb=d992fa555d23bb77079acd184ab60011277324d0;p=dpdk.git diff --git a/lib/librte_eal/common/eal_common_trace_ctf.c b/lib/librte_eal/common/eal_common_trace_ctf.c index 174cdac1b0..33e419aac7 100644 --- a/lib/librte_eal/common/eal_common_trace_ctf.c +++ b/lib/librte_eal/common/eal_common_trace_ctf.c @@ -37,11 +37,12 @@ meta_copy(char **meta, int *offset, char *str, int rc) if (rc < 0) return rc; - ptr = realloc(ptr, count + rc); + ptr = realloc(ptr, count + rc + 1); if (ptr == NULL) goto free_str; memcpy(RTE_PTR_ADD(ptr, count), str, rc); + ptr[count + rc] = '\0'; count += rc; free(str); @@ -231,9 +232,10 @@ meta_event_emit(char **meta, int *offset, struct trace_point *tp) " id = %d;\n" " name = \"%s\";\n" " fields := struct {\n" - " %s\n" + "%s" " };\n" - "};\n\n", trace_id_get(tp->handle), tp->name, tp->ctf_field); + "};\n\n", trace_id_get(tp->handle), tp->name, + tp->ctf_field != NULL ? tp->ctf_field : ""); return meta_copy(meta, offset, str, rc); }