aboutsummaryrefslogtreecommitdiff
path: root/PORTING.md
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2017-09-07 18:38:32 -0400
committerDavid Benjamin <davidben@google.com>2017-09-07 23:04:31 +0000
commit6881ec04656ce1829136b3412afbf5f84287f476 (patch)
tree3cb32c8bee323f06568364b83406a27df8f4528c /PORTING.md
parent2978d055f69a8d3f16b995fec50c18beaf1ce5ce (diff)
downloadboringssl-6881ec04656ce1829136b3412afbf5f84287f476.zip
boringssl-6881ec04656ce1829136b3412afbf5f84287f476.tar.gz
boringssl-6881ec04656ce1829136b3412afbf5f84287f476.tar.bz2
Add a note to PORTING.md about free/OPENSSL_free mixups.
Change-Id: I7cf0e67148c0908e5a4c670251419a8bc15fbea9 Reviewed-on: https://boringssl-review.googlesource.com/20109 Reviewed-by: Martin Kreichgauer <martinkr@google.com>
Diffstat (limited to 'PORTING.md')
-rw-r--r--PORTING.md11
1 files changed, 11 insertions, 0 deletions
diff --git a/PORTING.md b/PORTING.md
index e2fdb3a..c9a16d6 100644
--- a/PORTING.md
+++ b/PORTING.md
@@ -165,6 +165,17 @@ recommended to avoid the `out` parameter completely and always pass in `NULL`.
Note that less error-prone APIs are available for BoringSSL-specific code (see
below).
+### Memory allocation
+
+OpenSSL provides wrappers `OPENSSL_malloc` and `OPENSSL_free` over the standard
+`malloc` and `free`. Memory allocated by OpenSSL should be released with
+`OPENSSL_free`, not the standard `free`. However, by default, they are
+implemented directly using `malloc` and `free`, so code which mixes them up
+usually works.
+
+In BoringSSL, these functions maintain additional book-keeping to zero memory
+on `OPENSSL_free`, so any mixups must be fixed.
+
## Optional BoringSSL-specific simplifications
BoringSSL makes some changes to OpenSSL which simplify the API but remain