[asterisk-commits] rmudgett: trunk r360626 - /trunk/main/astobj2.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 27 12:00:16 CDT 2012


Author: rmudgett
Date: Tue Mar 27 12:00:13 2012
New Revision: 360626

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=360626
Log:
Attempt to be more helpful when using a bad ao2 object pointer.

Modified:
    trunk/main/astobj2.c

Modified: trunk/main/astobj2.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/astobj2.c?view=diff&rev=360626&r1=360625&r2=360626
==============================================================================
--- trunk/main/astobj2.c (original)
+++ trunk/main/astobj2.c Tue Mar 27 12:00:13 2012
@@ -142,8 +142,13 @@
 	}
 
 	p = (struct astobj2 *) ((char *) user_data - sizeof(*p));
-	if (AO2_MAGIC != (p->priv_data.magic) ) {
-		ast_log(LOG_ERROR, "bad magic number 0x%x for %p\n", p->priv_data.magic, p);
+	if (AO2_MAGIC != p->priv_data.magic) {
+		if (p->priv_data.magic) {
+			ast_log(LOG_ERROR, "bad magic number 0x%x for %p\n", p->priv_data.magic, p);
+		} else {
+			ast_log(LOG_ERROR,
+				"bad magic number for %p. Object is likely destroyed.\n", p);
+		}
 		return NULL;
 	}
 




More information about the asterisk-commits mailing list