From 24802ecad368c9c89fd10ed51b83ff68a41d5a1d Mon Sep 17 00:00:00 2001 From: Erik Boasson Date: Mon, 7 Jan 2019 18:55:42 +0100 Subject: [PATCH] avoid setting topic and type name in the QoS objects returned in the built-in topics Signed-off-by: Erik Boasson --- src/core/ddsi/src/ddsi_serdata_builtin.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/core/ddsi/src/ddsi_serdata_builtin.c b/src/core/ddsi/src/ddsi_serdata_builtin.c index 0623ded..7498721 100644 --- a/src/core/ddsi/src/ddsi_serdata_builtin.c +++ b/src/core/ddsi/src/ddsi_serdata_builtin.c @@ -188,13 +188,22 @@ static char *dds_string_dup_reuse (char *old, const char *src) static dds_qos_t *dds_qos_from_xqos_reuse (dds_qos_t *old, const nn_xqos_t *src) { if (old == NULL) - return nn_xqos_dup (src); + { + old = os_malloc (sizeof (*old)); + nn_xqos_init_empty (old); + old->present |= QP_TOPIC_NAME | QP_TYPE_NAME; + nn_xqos_mergein_missing (old, src); + old->present &= ~(QP_TOPIC_NAME | QP_TYPE_NAME); + } else { nn_xqos_fini (old); + nn_xqos_init_empty (old); + old->present |= QP_TOPIC_NAME | QP_TYPE_NAME; nn_xqos_mergein_missing (old, src); - return old; + old->present &= ~(QP_TOPIC_NAME | QP_TYPE_NAME); } + return old; } static bool to_sample_pp (const struct ddsi_serdata_builtin *d, struct dds_builtintopic_participant *sample)