From: Martin Schwenke Date: Fri, 26 Sep 2025 05:58:26 +0000 (+1000) Subject: ctdb-event: Don't replace an existing result with NULL X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=52ab5fa8b2b3c0cf1e464d939f9930cb63b243e6;p=thirdparty%2Fsamba.git 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 --- 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; }