[asterisk-commits] russell: branch 1.4 r82198 - /branches/1.4/main/astobj2.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 10 14:53:18 CDT 2007


Author: russell
Date: Mon Sep 10 14:53:17 2007
New Revision: 82198

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82198
Log:
backport astobj2 race condition fix.  This function is the exact same as trunk
so it applies here as well.

Modified:
    branches/1.4/main/astobj2.c

Modified: branches/1.4/main/astobj2.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/astobj2.c?view=diff&rev=82198&r1=82197&r2=82198
==============================================================================
--- branches/1.4/main/astobj2.c (original)
+++ branches/1.4/main/astobj2.c Mon Sep 10 14:53:17 2007
@@ -513,6 +513,7 @@
 {
 	int lim;
 	struct bucket_list *p = NULL;
+	void *ret = NULL;
 
 	if (INTERNAL_OBJ(a->c) == NULL)
 		return NULL;
@@ -553,14 +554,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