Skip to content

Conversation

@bagder
Copy link
Member

@bagder bagder commented Dec 25, 2025

No description provided.

@bagder bagder marked this pull request as ready for review December 25, 2025 17:07
@bagder bagder requested a review from Copilot December 25, 2025 17:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes error handling in the thread creation function by preventing an unnecessary memory allocation when the initial allocation fails. The change ensures that if the first curlx_malloc for the thread handle fails, the second curlx_malloc for the actual call structure is skipped entirely.

Key changes:

  • Initialize ac pointer to NULL instead of immediately allocating memory
  • Conditionally allocate ac only if the thread handle t was successfully allocated
  • Maintains existing error handling logic at the err label

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bagder bagder closed this in d4b62bf Dec 25, 2025
@bagder bagder deleted the bagder/threads-oom branch December 25, 2025 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant