summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-11-07 17:35:52 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-11-07 17:36:57 +0900
commit3790c4d47a63fad4bee5d22d70df003aa39bab3a (patch)
tree60b19f83598e021762d4de4e40d1e3c7de0a66d5
parenteb67a08c8daff89e88063a4d06dbf07a6bac3379 (diff)
eina freeq - make it clear that content is invalid on submission
and that the free function cannot access content of the pointer (unless the pointer memory size is 0).
-rw-r--r--src/lib/eina/eina_freeq.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/eina/eina_freeq.h b/src/lib/eina/eina_freeq.h
index 834e168764..2fef71d7ce 100644
--- a/src/lib/eina/eina_freeq.h
+++ b/src/lib/eina/eina_freeq.h
@@ -291,6 +291,18 @@ eina_freeq_ptr_pending(Eina_FreeQ *fq);
291 * tools like valgrind, eina detects this and will also immediately free 291 * tools like valgrind, eina detects this and will also immediately free
292 * the data so valgrind's own memory checkers can detect use after free 292 * the data so valgrind's own memory checkers can detect use after free
293 * as normal. 293 * as normal.
294 *
295 * Note: The free function must not access the CONTENT of the memory to be
296 * freed, or at least consider it invalid and full of garbage. It is already
297 * invalid at the moment it is added to the free queue. Just the actual
298 * free function may be delayed. The free function may also not access other
299 * memory already freed before being added to the free queue. They may do
300 * tricks like use memory headers that are outside the memory region to be
301 * freed (pass in pointer char *x, then char *header_address = x - 16 to get
302 * header information) as this header is not considered part of the free data.
303 * This note does not apply if you use a size of 0 for the pointer, but then
304 * you lose canary debugging ability when using 0 sized pointers on the free
305 * queue.
294 * 306 *
295 * @since 1.19 307 * @since 1.19
296 */ 308 */