Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an invalid SPI result use after free #6029

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/hypertable.c
Original file line number Diff line number Diff line change
Expand Up @@ -2974,10 +2974,13 @@ ts_hypertable_get_open_dim_max_value(const Hypertable *ht, int dimension_index,
if (isnull)
*isnull = max_isnull;

int64 max_value =
max_isnull ? ts_time_get_min(timetype) : ts_time_value_to_internal(maxdat, timetype);

if ((res = SPI_finish()) != SPI_OK_FINISH)
elog(ERROR, "SPI_finish failed: %s", SPI_result_code_string(res));

return max_isnull ? ts_time_get_min(timetype) : ts_time_value_to_internal(maxdat, timetype);
return max_value;
}

bool
Expand Down