[asterisk-commits] murf: trunk r82124 - /trunk/main/astobj2.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 10 11:19:45 CDT 2007


Author: murf
Date: Mon Sep 10 11:19:45 2007
New Revision: 82124

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82124
Log:
Changes applied from marta's team/marta/astobj2 branch to solve a race condition

Modified:
    trunk/main/astobj2.c

Modified: trunk/main/astobj2.c
URL: http://svn.digium.com/view/asterisk/trunk/main/astobj2.c?view=diff&rev=82124&r1=82123&r2=82124
==============================================================================
--- trunk/main/astobj2.c (original)
+++ trunk/main/astobj2.c Mon Sep 10 11:19:45 2007
@@ -501,6 +501,7 @@
 {
 	int lim;
 	struct bucket_list *p = NULL;
+	void *ret = NULL;
 
 	if (INTERNAL_OBJ(a->c) == NULL)
 		return NULL;
@@ -541,14 +542,15 @@
 		a->version = p->version;
 		a->obj = p;
 		a->c_version = a->c->version;
+		ret = EXTERNAL_OBJ(p->astobj);
 		/* inc refcount of returned object */
-		ao2_ref(EXTERNAL_OBJ(p->astobj), 1);
+		ao2_ref(ret, 1);
 	}
 
 	if (!(a->flags & F_AO2I_DONTLOCK))
 		ao2_unlock(a->c);
 
-	return p ? EXTERNAL_OBJ(p->astobj) : NULL;
+	return ret;
 }
 
 /* callback for destroying container.




More information about the asterisk-commits mailing list