From 52ab5fa8b2b3c0cf1e464d939f9930cb63b243e6 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Fri, 26 Sep 2025 15:58:26 +1000 Subject: [PATCH] ctdb-event: Don't replace an existing result with NULL If script_list is NULL then event->script_list is set to NULL by TALLOC_FREE(). This seems like the wrong thing to do because NULL indicates a problem running the current event. We should keep the previous result because it contains useful information. In theory, this can't happen because the caller checks for NULL. However, given that the check is here, it might as well do the right thing... and this simplifies a subsequent change. Signed-off-by: Martin Schwenke Reviewed-by: Ralph Boehme --- ctdb/event/event_context.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ctdb/event/event_context.c b/ctdb/event/event_context.c index 79bcd834576..e26d9ae4d1c 100644 --- a/ctdb/event/event_context.c +++ b/ctdb/event/event_context.c @@ -141,11 +141,14 @@ static int eventd_event_set(struct event_component *comp, return ret; } - TALLOC_FREE(event->script_list); - if (script_list != NULL) { - event->script_list = talloc_steal(event, script_list); + /* Don't replace previous result with a failed one */ + if (script_list == NULL) { + return 0; } + TALLOC_FREE(event->script_list); + event->script_list = talloc_steal(event, script_list); + return 0; } -- 2.47.3