base/allocator: Intercept strdup on Android when use_allocator_shim
On Android, malloc, free, etc. are intercepted by using the linker option -Wl,-wrap,FUNC , which means we're intercepting only the symbols undefined at link time. Non-undefined symbols like a call to malloc inside libc are not intercepted. strdup and strndup are such functions that internally call to malloc. However, the return values of strdup/strndup are deallocated with free (= our own free), so we should intercept strdup/strndup to have them use our own malloc. This patch implements wrapper functions for strdup/strndup just like one for malloc. Bug: 1111332 Change-Id: I5747a2c32f19bb63c0380f10f589b9a8f6dd3b19 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2418513Reviewed-by:Kentaro Hara <haraken@chromium.org> Reviewed-by:
Benoit L <lizeb@chromium.org> Reviewed-by:
Bartek Nowierski <bartekn@chromium.org> Commit-Queue: Yuki Shiino <yukishiino@chromium.org> Cr-Commit-Position: refs/heads/master@{#808861}
Showing
Please register or sign in to comment