This is an archive of the discontinued LLVM Phabricator instance.

[Support] [IR] [ADT] - Check nullptr after allocation with malloc/realloc or calloc
ClosedPublic

Authored by kkretzsch on Jul 14 2017, 6:07 AM.

Details

Summary

As a follow up of the bad alloc handler patch, this patch introduces nullptr checks on pointers returned from the
malloc/realloc/calloc functions. In addition some memory size assignments are moved behind the allocation
of the corresponding memory to fulfill exception safe memory management (RAII).

patch by Klaus Kretzschmar

Diff Detail

Repository
rL LLVM

Event Timeline

kkretzsch created this revision.Jul 14 2017, 6:07 AM
MatzeB accepted this revision.Jul 14 2017, 9:17 AM

LGTM

This revision is now accepted and ready to land.Jul 14 2017, 9:17 AM

Thanks for reviewing my change. Since I do not have commit access to trunk, can somebody push my change to trunk?

Thanks!
Klaus

This revision was automatically updated to reflect the committed changes.

Finally got around pushing this. You may consider asking for commit access (https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access) if you plan further changes.

Finally got around pushing this. You may consider asking for commit access (https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access) if you plan further changes.

Thanks Matthias! Yes, I'll ask for the commit access.