René's URL Explorer Experiment


Title: Do not double free during callbacks. by mcollina · Pull Request #338 · nodegit/nodegit · GitHub

Open Graph Title: Do not double free during callbacks. by mcollina · Pull Request #338 · nodegit/nodegit

X Title: Do not double free during callbacks. by mcollina · Pull Request #338 · nodegit/nodegit

Description: Continuing from #331, as it is a different issue. Here is the backtrace obtained via lldb: * thread #1: tid = 0xdd2c0, 0x00007fff973f219f libsystem_malloc.dylib`malloc_error_break, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 * frame #0: 0x00007fff973f219f libsystem_malloc.dylib`malloc_error_break frame #1: 0x00007fff973e38c5 libsystem_malloc.dylib`free + 314 frame #2: 0x000000010327f77b nodegit.node`GitCommit::LookupWorker::HandleOKCallback(this=0x0000000100d09790) + 859 at commit.cc:689 frame #3: 0x000000010324d812 nodegit.node`NanAsyncWorker::WorkComplete(this=0x0000000100d09790) + 66 at nan.h:1881 frame #4: 0x000000010324e2d1 nodegit.node`NanAsyncExecuteComplete(req=0x0000000100d09798) + 33 at nan.h:1948 frame #5: 0x00000001004598da node`uv__work_done + 168 frame #6: 0x0000000100450717 node`uv__async_event + 62 frame #7: 0x000000010045088a node`uv__async_io + 136 frame #8: 0x000000010045d256 node`uv__io_poll + 1463 frame #9: 0x0000000100450cd1 node`uv_run + 239 frame #10: 0x0000000100409e6a node`node::Start(int, char**) + 365 frame #11: 0x0000000100000b74 node`start + 52 Here is the relevant part of commit.cc in which the error happen: void GitCommit::LookupWorker::HandleOKCallback() { TryCatch try_catch; if (baton->error_code == GIT_OK) { Handle to; // start convert_to_v8 block if (baton->commit != NULL) { // GitCommit baton->commit to = GitCommit::New((void *)baton->commit, false); } else { to = NanNull(); } // end convert_to_v8 block Handle result = to; Handle argv[2] = { NanNull(), result }; callback->Call(2, argv); } else { if (baton->error) { Handle argv[1] = { NanError(baton->error->message) }; callback->Call(1, argv); if (baton->error->message) free((void *)baton->error->message); free((void *)baton->error); } else { callback->Call(0, NULL); } free((void*)baton->id); // here is the first free } if (try_catch.HasCaught()) { node::FatalException(try_catch); } if (baton->idNeedsFree) { free((void *)baton->id); // here happens the problem, the second free } delete baton; } Adding this line before the first free fixes it. baton->idNeedsFree = false; I did that in the templates. Let me know if it is ok, or if I should change something. I can even add a unit test, but I might need some pointers in how catch the issue in the smallest case.

Open Graph Description: Continuing from #331, as it is a different issue. Here is the backtrace obtained via lldb: * thread #1: tid = 0xdd2c0, 0x00007fff973f219f libsystem_malloc.dylib`malloc_error_break, queue = 'com...

X Description: Continuing from #331, as it is a different issue. Here is the backtrace obtained via lldb: * thread #1: tid = 0xdd2c0, 0x00007fff973f219f libsystem_malloc.dylib`malloc_error_break, queue = &#39...

Opengraph URL: https://github.com/nodegit/nodegit/pull/338

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:58da0224-de57-5bf5-3ee0-9bc14aedc28e
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id8FF0:20DA71:9ED79EB:D79B637:6A5EF40C
html-safe-noncee2961fbb195b2d250dd2c2aac6eb04c909a0c293f93bd1f5830fd00c93dae0a5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RkYwOjIwREE3MTo5RUQ3OUVCOkQ3OUI2Mzc6NkE1RUY0MEMiLCJ2aXNpdG9yX2lkIjoiNjgwNTYwODU2ODMwODI5ODc2NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac21ee58c3ae71eb3ec7c1fb033cda5f1cf565fb45a8d07bf0e98ad7cc3d899e89
hovercard-subject-tagpull_request:26958172
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/nodegit/nodegit/pull/338/files
twitter:imagehttps://avatars.githubusercontent.com/u/52195?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/52195?s=400&v=4
og:image:altContinuing from #331, as it is a different issue. Here is the backtrace obtained via lldb: * thread #1: tid = 0xdd2c0, 0x00007fff973f219f libsystem_malloc.dylib`malloc_error_break, queue = 'com...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None82d0004a35927bdb00c652a57f456c55aa0eda4ade1bc7956d7510fdea6e454b
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/nodegit/nodegit git https://github.com/nodegit/nodegit.git
octolytics-dimension-user_id657068
octolytics-dimension-user_loginnodegit
octolytics-dimension-repository_id1383170
octolytics-dimension-repository_nwonodegit/nodegit
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1383170
octolytics-dimension-repository_network_root_nwonodegit/nodegit
turbo-body-classeslogged-out env-production page-responsive
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
released2d913dd727d2d7ac189fb4d05b10bc34ecd03ee
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodegit/nodegit/pull/338/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodegit%2Fnodegit%2Fpull%2F338%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodegit%2Fnodegit%2Fpull%2F338%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=nodegit%2Fnodegit
Reloadhttps://github.com/nodegit/nodegit/pull/338/files
Reloadhttps://github.com/nodegit/nodegit/pull/338/files
Reloadhttps://github.com/nodegit/nodegit/pull/338/files
Please reload this pagehttps://github.com/nodegit/nodegit/pull/338/files
nodegit https://github.com/nodegit
nodegithttps://github.com/nodegit/nodegit
Notifications https://github.com/login?return_to=%2Fnodegit%2Fnodegit
Fork 698 https://github.com/login?return_to=%2Fnodegit%2Fnodegit
Star 5.8k https://github.com/login?return_to=%2Fnodegit%2Fnodegit
Code https://github.com/nodegit/nodegit
Issues 343 https://github.com/nodegit/nodegit/issues
Pull requests 20 https://github.com/nodegit/nodegit/pulls
Actions https://github.com/nodegit/nodegit/actions
Projects https://github.com/nodegit/nodegit/projects
Security and quality 0 https://github.com/nodegit/nodegit/security
Insights https://github.com/nodegit/nodegit/pulse
Code https://github.com/nodegit/nodegit
Issues https://github.com/nodegit/nodegit/issues
Pull requests https://github.com/nodegit/nodegit/pulls
Actions https://github.com/nodegit/nodegit/actions
Projects https://github.com/nodegit/nodegit/projects
Security and quality https://github.com/nodegit/nodegit/security
Insights https://github.com/nodegit/nodegit/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fnodegit%2Fnodegit%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fnodegit%2Fnodegit%2Fissues%2Fnew%2Fchoose
johnhaley81https://github.com/johnhaley81
nodegit:masterhttps://github.com/nodegit/nodegit/tree/master
mcollina:masterhttps://github.com/mcollina/nodegit/tree/master
Conversation 12 https://github.com/nodegit/nodegit/pull/338
Commits 2 https://github.com/nodegit/nodegit/pull/338/commits
Checks 0 https://github.com/nodegit/nodegit/pull/338/checks
Files changed https://github.com/nodegit/nodegit/pull/338/files
Please reload this pagehttps://github.com/nodegit/nodegit/pull/338/files
Do not double free during callbacks. https://github.com/nodegit/nodegit/pull/338/files#top
Show all changes 2 commits https://github.com/nodegit/nodegit/pull/338/files
022884d Do not double free during callbacks. mcollina Jan 7, 2015 https://github.com/nodegit/nodegit/pull/338/commits/022884d961f3977e3b6286265d7c853e97155d5f
afc9513 Safer NeedsFree handling. mcollina Jan 7, 2015 https://github.com/nodegit/nodegit/pull/338/commits/afc9513cd21b71620f07d3da26b3cf330e4a1f43
Clear filters https://github.com/nodegit/nodegit/pull/338/files
Please reload this pagehttps://github.com/nodegit/nodegit/pull/338/files
Please reload this pagehttps://github.com/nodegit/nodegit/pull/338/files
generate/combyne/partials/async_function.cchttps://github.com/nodegit/nodegit/pull/338/files#diff-1d9fdc6c58501e5df78515b36b272c082bce9c9e74feefa7f0e6ab1fc8a78998
View file https://github.com/mcollina/nodegit/blob/afc9513cd21b71620f07d3da26b3cf330e4a1f43/generate/combyne/partials/async_function.cc
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodegit/nodegit/pull/338/{{ revealButtonHref }}
https://github.com/nodegit/nodegit/pull/338/files#diff-1d9fdc6c58501e5df78515b36b272c082bce9c9e74feefa7f0e6ab1fc8a78998
https://github.com/nodegit/nodegit/pull/338/files#diff-1d9fdc6c58501e5df78515b36b272c082bce9c9e74feefa7f0e6ab1fc8a78998
https://github.com/nodegit/nodegit/pull/338/files#diff-1d9fdc6c58501e5df78515b36b272c082bce9c9e74feefa7f0e6ab1fc8a78998
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.