Clarify BIO_new_mum_buf's lifetime rules. It is not obvious from "It does not take ownership of |buf|" whether the function makes a copy or not. It does not make a copy (maybe it should...), so callers are obligated to manage their lifetimes. Change-Id: I7df9a5814321fd833fcb8d009d9e0318d6668dd4 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48669 Reviewed-by: Adam Langley <agl@google.com>
diff --git a/include/openssl/bio.h b/include/openssl/bio.h index f25492a..18bc893 100644 --- a/include/openssl/bio.h +++ b/include/openssl/bio.h
@@ -377,7 +377,9 @@ OPENSSL_EXPORT const BIO_METHOD *BIO_s_mem(void); // BIO_new_mem_buf creates read-only BIO that reads from |len| bytes at |buf|. -// It does not take ownership of |buf|. It returns the BIO or NULL on error. +// It returns the BIO or NULL on error. This function does not copy or take +// ownership of |buf|. The caller must ensure the memory pointed to by |buf| +// outlives the |BIO|. // // If |len| is negative, then |buf| is treated as a NUL-terminated string, but // don't depend on this in new code.