[svn-commits] kmoore: branch kmoore/stasis-mwi r382556 - /team/kmoore/stasis-mwi/main/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Mar 6 18:09:36 CST 2013


Author: kmoore
Date: Wed Mar  6 18:09:32 2013
New Revision: 382556

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382556
Log:
Make things a tad more readable and pull in a memory leak fix

Modified:
    team/kmoore/stasis-mwi/main/app.c
    team/kmoore/stasis-mwi/main/threadpool.c

Modified: team/kmoore/stasis-mwi/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/main/app.c?view=diff&rev=382556&r1=382555&r2=382556
==============================================================================
--- team/kmoore/stasis-mwi/main/app.c (original)
+++ team/kmoore/stasis-mwi/main/app.c Wed Mar  6 18:09:32 2013
@@ -2686,36 +2686,36 @@
 
 struct stasis_topic *stasis_mwi_topic(const char *uniqueid)
 {
-	RAII_VAR(struct mwi_topic *, topic, ao2_find(__mwi_topics, uniqueid, OBJ_KEY), ao2_cleanup);
-
-	if (topic) {
-		return topic->topic;
-	}
-
-	topic = mwi_topic_alloc();
-
-	if (!topic) {
+	RAII_VAR(struct mwi_topic *, mwi_topic, ao2_find(__mwi_topics, uniqueid, OBJ_KEY), ao2_cleanup);
+
+	if (mwi_topic) {
+		return mwi_topic->topic;
+	}
+
+	mwi_topic = mwi_topic_alloc();
+
+	if (!mwi_topic) {
 		return NULL;
 	}
 
-	topic->topic = stasis_topic_create(uniqueid);
-	if (!topic->topic) {
+	mwi_topic->topic = stasis_topic_create(uniqueid);
+	if (!mwi_topic->topic) {
 		return NULL;
 	}
 
-	topic->forward = stasis_forward_all(topic->topic, stasis_mwi_topic_all());
-	if (!topic->forward) {
+	mwi_topic->forward = stasis_forward_all(topic->topic, stasis_mwi_topic_all());
+	if (!mwi_topic->forward) {
 		return NULL;
 	}
 
-	topic->uniqueid = ast_strdup(uniqueid);
+	mwi_topic->uniqueid = ast_strdup(uniqueid);
 	if (!topic->uniqueid) {
 		return NULL;
 	}
 
-	ao2_link(__mwi_topics, topic);
-
-	return topic->topic;
+	ao2_link(__mwi_topics, mwi_topic);
+
+	return mwi_topic->topic;
 }
 
 int stasis_publish_mwi_state_full(

Modified: team/kmoore/stasis-mwi/main/threadpool.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/main/threadpool.c?view=diff&rev=382556&r1=382555&r2=382556
==============================================================================
--- team/kmoore/stasis-mwi/main/threadpool.c (original)
+++ team/kmoore/stasis-mwi/main/threadpool.c Wed Mar  6 18:09:32 2013
@@ -792,7 +792,7 @@
  */
 static int queued_set_size(void *data)
 {
-	struct set_size_data *ssd = data;
+	RAII_VAR(struct set_size_data *, ssd, data, ao2_cleanup);
 	struct ast_threadpool *pool = ssd->pool;
 	unsigned int num_threads = ssd->size;
 
@@ -813,7 +813,6 @@
 	}
 
 	threadpool_send_state_changed(pool);
-	ao2_ref(ssd, -1);
 	return 0;
 }
 




More information about the svn-commits mailing list