Skip to content

Properly free Curl memory on palloc error#281

Closed
theory wants to merge 0 commit into
mainfrom
memleaks
Closed

Properly free Curl memory on palloc error#281
theory wants to merge 0 commit into
mainfrom
memleaks

Conversation

@theory

@theory theory commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

The Postgres memory context functions, including
AllocSetContextCreate(), palloc(), and friends, throw an error (longjmp) on error, leaving memory allocated by Curl living in the response object un-freed. Borrow the PG_TRY() pattern used by http_streaming_query() to catch these exceptions and free all the allocated memory. Resolves #274.

@theory theory self-assigned this Jun 15, 2026
@theory theory added the bug Something isn't working label Jun 15, 2026
@theory theory force-pushed the memleaks branch 2 times, most recently from 0268fc2 to 5b253c7 Compare June 15, 2026 15:20
@theory

theory commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator Author

Stupid GitHub, this was merged in 22d3c5d.

@theory theory deleted the memleaks branch June 15, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP driver leaks the full malloc'd response body if an ERROR is thrown before the cursor's reset callback is registered

2 participants