[asterisk-commits] dlee: branch dlee/performance r399500 - /team/dlee/performance/main/astobj2.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Sep 19 17:07:18 CDT 2013
Author: dlee
Date: Thu Sep 19 17:07:16 2013
New Revision: 399500
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399500
Log:
Maybe it's a good idea to set the magic _before_ freeing the memory
Modified:
team/dlee/performance/main/astobj2.c
Modified: team/dlee/performance/main/astobj2.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/main/astobj2.c?view=diff&rev=399500&r1=399499&r2=399500
==============================================================================
--- team/dlee/performance/main/astobj2.c (original)
+++ team/dlee/performance/main/astobj2.c Thu Sep 19 17:07:16 2013
@@ -477,6 +477,9 @@
ast_atomic_fetchadd_int(&ao2.total_mem, - obj->priv_data.data_size);
ast_atomic_fetchadd_int(&ao2.total_objects, -1);
#endif
+
+ /* In case someone uses an object after it's been freed */
+ obj->priv_data.magic = 0;
switch (obj->priv_data.options & AO2_ALLOC_OPT_LOCK_MASK) {
case AO2_ALLOC_OPT_LOCK_MUTEX:
@@ -523,9 +526,6 @@
"Invalid lock option on ao2 object %p\n", user_data);
break;
}
-
- /* In case someone uses an object after it's been freed */
- obj->priv_data.magic = 0;
return ret;
}
More information about the asterisk-commits
mailing list