diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-01-10 09:55:01 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-01-10 12:57:13 -0500 |
commit | 519fa1a3e6943f858b5dc1dee461053af1c187cd (patch) | |
tree | 993dddafdc614915600cc6196bca6280227ef624 | |
parent | f71bbd20a40de78fc1e7d722ba591578f137abec (diff) | |
download | tor-519fa1a3e6943f858b5dc1dee461053af1c187cd.tar.gz tor-519fa1a3e6943f858b5dc1dee461053af1c187cd.zip |
Document the alignment limitation of tor_free()
-rw-r--r-- | src/common/util.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/util.h b/src/common/util.h index 8dc64ce9fa..2ee0ea28cd 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -79,6 +79,11 @@ extern int dmalloc_free(const char *file, const int line, void *pnt, * * This is a macro. If you need a function pointer to release memory from * tor_malloc(), use tor_free_(). + * + * Note that this macro takes the address of the pointer it is going to + * free and clear. If that pointer is stored with a nonstandard + * alignment (eg because of a "packed" pragma) it is not correct to use + * tor_free(). */ #ifdef __GNUC__ #define tor_free(p) STMT_BEGIN \ |