Fix Web Sessions test response ownership

This commit is contained in:
fy59 2026-09-18 08:29:52 +02:00
parent 823184d99e
commit 4b76848c54
2 changed files with 9 additions and 0 deletions

View file

@ -24,6 +24,12 @@ typedef struct TrainlogWebSessionsPageQuery {
const char *search;
} TrainlogWebSessionsPageQuery;
/*
* CONTRACT: every successful JSON-producing function below transfers one
* heap allocation through output_json; the caller owns it and releases it
* with free(). Borrowed input strings need only remain valid for the call.
*/
/*
* CONTRACT: database and query strings are borrowed for the call. On success,
* output_json is heap-owned by the caller and must be released with free().

View file

@ -143,6 +143,9 @@ static bool creation_replay_revision_and_pagination(void) {
&updated_size) == TRAINLOG_STATUS_OK);
CHECK(updated_size > 0U);
CHECK(scalar(database, "SELECT COUNT(*) FROM session_preparation_revisions") == 2);
free(detail);
detail = NULL;
detail_size = 0U;
CHECK(trainlog_web_sessions_save_json(database,
NULL,
"",