From 7cc33ef7de8d41c8588e9229895c55fce4cbfa12 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 5 Jan 2024 13:29:18 -0500 Subject: [PATCH] mgmtd: msg is assigned yet never used again SA found this issue. let's clean this up. Signed-off-by: Donald Sharp --- mgmtd/mgmt_fe_adapter.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mgmtd/mgmt_fe_adapter.c b/mgmtd/mgmt_fe_adapter.c index d98444703f21..6bcbe12416f7 100644 --- a/mgmtd/mgmt_fe_adapter.c +++ b/mgmtd/mgmt_fe_adapter.c @@ -1103,9 +1103,12 @@ static int fe_adapter_send_tree_data(struct mgmt_fe_session_ctx *session, ret = yang_print_tree_append(&buf, tree, result_type, (LYD_PRINT_WD_EXPLICIT | LYD_PRINT_WITHSIBLINGS)); - /* buf may have been reallocated and moved */ - msg = (typeof(msg))buf; - + /* + * Reminder buf may have been reallocated and moved + * so if msg is needed to be used again after this + * then reassign it. + * msg = (typeof(msg))buf; + */ if (ret != LY_SUCCESS) { MGMTD_FE_ADAPTER_ERR("Error building get-tree result for client %s session-id %" PRIu64