This is an archive of the discontinued LLVM Phabricator instance.

Free zone name when destroying malloc zone
ClosedPublic

Authored by fjricci on Apr 12 2017, 10:47 AM.

Details

Summary

The darwin interceptor for malloc_destroy_zone manually frees the
zone struct, but does not free the name component. Make sure to
free the name if it has been set.

Diff Detail

Repository
rL LLVM

Event Timeline

fjricci created this revision.Apr 12 2017, 10:47 AM
alekseyshl accepted this revision.Apr 12 2017, 11:05 AM
alekseyshl added inline comments.
lib/sanitizer_common/sanitizer_malloc_mac.inc
62 ↗(On Diff #94998)

Nit: prefer no brackets for one liners

This revision is now accepted and ready to land.Apr 12 2017, 11:05 AM
fjricci added inline comments.Apr 12 2017, 11:45 AM
lib/sanitizer_common/sanitizer_malloc_mac.inc
62 ↗(On Diff #94998)

Even for macros?

alekseyshl added inline comments.Apr 12 2017, 3:08 PM
lib/sanitizer_common/sanitizer_malloc_mac.inc
62 ↗(On Diff #94998)

Ha, you're right, COMMON_MALLOC_FREE is . I was assuming multiline macro supposed to do this "do {} while (0)" trick. Anyway, ignore this nit.

fjricci added inline comments.Apr 13 2017, 7:11 AM
lib/sanitizer_common/sanitizer_malloc_mac.inc
62 ↗(On Diff #94998)

Yeah, it may be worth looking into fixing up our macros to use do/while in the future.

This revision was automatically updated to reflect the committed changes.