[svn-commits] russell: branch russell/cdr-q r249006 - /team/russell/cdr-q/main/cdr.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Feb 26 01:45:26 CST 2010


Author: russell
Date: Fri Feb 26 01:45:22 2010
New Revision: 249006

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=249006
Log:
Fix some reference leaks

Modified:
    team/russell/cdr-q/main/cdr.c

Modified: team/russell/cdr-q/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/cdr-q/main/cdr.c?view=diff&rev=249006&r1=249005&r2=249006
==============================================================================
--- team/russell/cdr-q/main/cdr.c (original)
+++ team/russell/cdr-q/main/cdr.c Fri Feb 26 01:45:22 2010
@@ -1456,6 +1456,14 @@
 	return -1;
 }
 
+/*!
+ * \internal
+ * \brief Flush the current queue of CDR records for a given backend sink
+ *
+ * \param arg an astobj2 reference to a backend
+ *
+ * \retval 0 always
+ */
 static int flush_cdr_q(void *arg)
 {
 	struct ast_cdr_backend *backend = arg;
@@ -1494,6 +1502,8 @@
 	}
 	ao2_unlock(backend);
 
+	ao2_t_ref(backend, -1, "done with ref in flush_cdr_q");
+
 	return 0;
 }
 
@@ -1552,7 +1562,7 @@
 	i = ao2_iterator_init(cdr_backends, 0);
 	while ((backend = ao2_iterator_next(&i))) {
 		ao2_lock(backend);
-		post_cdr_to_backend(backend, cdr);
+		post_cdr_to_backend(backend, cdr); /* reference passed on */
 		ao2_unlock(backend);
 	}
 	ao2_iterator_destroy(&i);
@@ -1846,6 +1856,8 @@
 {
 	struct ast_cdr_backend *backend = obj;
 
+	ao2_t_ref(backend, +1, "ref for bumping backend");
+
 	ast_taskprocessor_push(backend->tps, flush_cdr_q, backend);
 
 	return 0;




More information about the svn-commits mailing list