<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7914">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">stasis_cache: Remove silly usage of RAII_VAR.<br><br>Change-Id: Ifa95e5801c949df296c7e4376347730fb0ed52ef<br>---<br>M main/stasis_cache.c<br>1 file changed, 11 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/14/7914/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/stasis_cache.c b/main/stasis_cache.c<br>index f5037a4..ee9e56d 100644<br>--- a/main/stasis_cache.c<br>+++ b/main/stasis_cache.c<br>@@ -870,9 +870,8 @@<br> <br> struct stasis_caching_topic *stasis_caching_topic_create(struct stasis_topic *original_topic, struct stasis_cache *cache)<br> {<br>- RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, ao2_cleanup);<br>- struct stasis_subscription *sub;<br>- RAII_VAR(char *, new_name, NULL, ast_free);<br>+ struct stasis_caching_topic *caching_topic;<br>+ char *new_name;<br> int ret;<br> <br> ret = ast_asprintf(&new_name, "%s-cached", stasis_topic_name(original_topic));<br>@@ -883,28 +882,31 @@<br> caching_topic = ao2_alloc_options(sizeof(*caching_topic),<br> stasis_caching_topic_dtor, AO2_ALLOC_OPT_LOCK_NOLOCK);<br> if (caching_topic == NULL) {<br>+ ast_free(new_name);<br>+<br> return NULL;<br> }<br> <br> caching_topic->topic = stasis_topic_create(new_name);<br>+ ast_free(new_name);<br> if (caching_topic->topic == NULL) {<br>+ ao2_ref(caching_topic, -1);<br>+<br> return NULL;<br> }<br> <br> ao2_ref(cache, +1);<br> caching_topic->cache = cache;<br> <br>- sub = internal_stasis_subscribe(original_topic, caching_topic_exec, caching_topic, 0, 0);<br>- if (sub == NULL) {<br>+ caching_topic->sub = internal_stasis_subscribe(original_topic, caching_topic_exec, caching_topic, 0, 0);<br>+ if (caching_topic->sub == NULL) {<br>+ ao2_ref(caching_topic, -1);<br>+<br> return NULL;<br> }<br> <br> ao2_ref(original_topic, +1);<br> caching_topic->original_topic = original_topic;<br>-<br>- /* This is for the reference contained in the subscription above */<br>- ao2_ref(caching_topic, +1);<br>- caching_topic->sub = sub;<br> <br> /* The subscription holds the reference, so no additional ref bump. */<br> return caching_topic;<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7914">change 7914</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/7914"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ifa95e5801c949df296c7e4376347730fb0ed52ef </div>
<div style="display:none"> Gerrit-Change-Number: 7914 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>