mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-08 06:48:28 +00:00
45d3cc73dc
A lot of patch files are renamed in this update. Submitted by: Timothy Vaccarelli Obtained from: https://github.com/LeFroid/ MFH: 2016Q2 Security: http://vuxml.freebsd.org/freebsd/c039a761-2c29-11e6-8912-3065ec8fd3ec.html Security: http://vuxml.freebsd.org/freebsd/1a6bbb95-24b8-11e6-bd31-3065ec8fd3ec.html Security: http://vuxml.freebsd.org/freebsd/4dfafa16-24ba-11e6-bd31-3065ec8fd3ec.html Security: http://vuxml.freebsd.org/freebsd/7da1da96-24bb-11e6-bd31-3065ec8fd3ec.html Security: http://vuxml.freebsd.org/freebsd/6d8505f0-0614-11e6-b39c-00262d5ed8ee.html
40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
--- base/process/memory.cc.orig 2016-03-25 13:04:44 UTC
|
|
+++ base/process/memory.cc
|
|
@@ -46,4 +46,36 @@ bool UncheckedCalloc(size_t num_items, s
|
|
|
|
#endif
|
|
|
|
+#if defined(OS_FREEBSD)
|
|
+
|
|
+#if defined(USE_TCMALLOC)
|
|
+// Used by UncheckedMalloc. If tcmalloc is linked to the executable
|
|
+// this will be replaced by a strong symbol that actually implement
|
|
+// the semantics and don't call new handler in case the allocation fails.
|
|
+extern "C" {
|
|
+
|
|
+__attribute__((weak, visibility("default")))
|
|
+void* tc_malloc_skip_new_handler_weak(size_t size);
|
|
+
|
|
+void* tc_malloc_skip_new_handler_weak(size_t size) {
|
|
+ return malloc(size);
|
|
+}
|
|
+
|
|
+}
|
|
+#endif
|
|
+
|
|
+bool UncheckedMalloc(size_t size, void** result) {
|
|
+#if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) || \
|
|
+ (!defined(LIBC_GLIBC) && !defined(USE_TCMALLOC))
|
|
+ *result = malloc(size);
|
|
+#elif defined(LIBC_GLIBC) && !defined(USE_TCMALLOC)
|
|
+ *result = __libc_malloc(size);
|
|
+#elif defined(USE_TCMALLOC)
|
|
+ *result = tc_malloc_skip_new_handler_weak(size);
|
|
+#endif
|
|
+ return *result != NULL;
|
|
+}
|
|
+
|
|
+#endif // defined(OS_FREEBSD)
|
|
+
|
|
} // namespace base
|