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 <mschwenke@ddn.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
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;
}