summaryrefslogtreecommitdiff
path: root/main/astobj2.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2014-09-18 16:56:40 +0000
committerRichard Mudgett <rmudgett@digium.com>2014-09-18 16:56:40 +0000
commita7add3a257fbbc4c692b4fb751668828b52c96c0 (patch)
treea64f5f7e50485e69fd028c2fb8a36d80380d2486 /main/astobj2.c
parentfa6313ad29153c17786b88693729f7a413e3f3e8 (diff)
astobj2.c/refcounter.py: Fix to deal with invalid object refs.
* Make astob2 REF_DEBUG output an invalid object line when an invalid ao2 object ref/unref is attempted. This is similar to the constructor/destructor lines. * Fixed refcounter.py to handle skewed objects that have constructor/destructor states. * Made refcounter.py highlight the invalid ao2 object refs by putting them in their own section of the processed output file. * Made refcounter.py highlight unreffing an object by more than one that results in a negative ref count and the object being destroyed. The abnormally destroyed object is reported in the invalid and finalized object sections of the output. Review: https://reviewboard.asterisk.org/r/3971/ ........ Merged revisions 423349 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 423400 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 423416 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 423418 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423422 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/astobj2.c')
-rw-r--r--main/astobj2.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/main/astobj2.c b/main/astobj2.c
index 2dd9f0536..7f7d9bd92 100644
--- a/main/astobj2.c
+++ b/main/astobj2.c
@@ -485,8 +485,14 @@ int __ao2_ref_debug(void *user_data, int delta, const char *tag, const char *fil
}
if (ref_log && user_data) {
- if (obj && old_refcount + delta == 0) {
- fprintf(ref_log, "%p,%d,%d,%s,%d,%s,**destructor**,%s\n", user_data, delta, ast_get_tid(), file, line, func, tag);
+ if (!obj) {
+ /* Invalid object: Bad magic number. */
+ fprintf(ref_log, "%p,%d,%d,%s,%d,%s,**invalid**,%s\n",
+ user_data, delta, ast_get_tid(), file, line, func, tag);
+ fflush(ref_log);
+ } else if (old_refcount + delta == 0) {
+ fprintf(ref_log, "%p,%d,%d,%s,%d,%s,**destructor**,%s\n",
+ user_data, delta, ast_get_tid(), file, line, func, tag);
fflush(ref_log);
} else if (delta != 0) {
fprintf(ref_log, "%p,%s%d,%d,%s,%d,%s,%d,%s\n", user_data, (delta < 0 ? "" : "+"),