diff --git a/clang/docs/analyzer/user-docs/Annotations.rst b/clang/docs/analyzer/user-docs/Annotations.rst index 3b5a13fd91d9b..957fc8d273c6a 100644 --- a/clang/docs/analyzer/user-docs/Annotations.rst +++ b/clang/docs/analyzer/user-docs/Annotations.rst @@ -207,7 +207,8 @@ Use this attribute to mark functions that take ownership of memory and will deal void __attribute((ownership_holds(malloc, 2))) store_in_table(int key, record_t *val); -The annotations ``ownership_takes`` and ``ownership_holds`` both prevent memory leak reports (concerning the specified parameter); the difference between them is that using taken memory is a use-after-free error, while using held memory is assumed to be legitimate. +The annotations ``ownership_takes`` and ``ownership_holds`` both prevent memory leak reports (concerning the specified parameter); the difference between them is that using taken memory is a use-after-free error, while using held memory is assumed to be legitimate. However, releasing the held memory or passing it to another holding call is reported by the analyzer as an "attempt to release non-owned memory". + Mac OS X API Annotations ________________________ diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index 4b45f413054f3..19d14837679d3 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -1663,7 +1663,9 @@ safely deallocated with the standard ``free()``. The annotations ``ownership_takes`` and ``ownership_holds`` both prevent memory leak reports (concerning the specified parameter); the difference between them is that using taken memory is a use-after-free error, while using held memory -is assumed to be legitimate. +is assumed to be legitimate. However, releasing the held memory or passing it +to another holding call is reported by the analyzer as an "attempt to release +non-owned memory". Example: