pgcentralfoundation / pgrx

Build Postgres Extensions with Rust!
Other
3.7k stars 249 forks source link

fix: crash from drop impls that panic via `leak_and_drop_on_delete()` #1929

Closed eeeebbbbrrrr closed 3 weeks ago

eeeebbbbrrrr commented 3 weeks ago

If PgMemoryContexts::leak_and_drop_on_delete() leaks a type that is impl Drop, and that implementation happens to panic, then Postgres will segfault because the callback function was not properly guarded.

As a drive-by, slightly cleanup error reporting in the test framework.