]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Document the alignment limitation of tor_free()
authorNick Mathewson <nickm@torproject.org>
Wed, 10 Jan 2018 14:55:01 +0000 (09:55 -0500)
committerNick Mathewson <nickm@torproject.org>
Wed, 10 Jan 2018 17:57:13 +0000 (12:57 -0500)
src/common/util.h

index 8dc64ce9faae0b8781bbdc6aa0ed1f5d6a55d485..2ee0ea28cd9db51a84dc2c536c898a909484a2c8 100644 (file)
@@ -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                                 \