<p>Joshua Colp <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19367">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span></span><br></pre><div style="white-space:pre-wrap">Approvals:
  George Joseph: Looks good to me, approved
  Joshua Colp: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_prometheus: Do not crash on invisible bridges<br><br>Avoid crashing by skipping invisible bridges and checking the<br>snapshot for a null pointer. In effect this is how the bridges<br>are enumerated in res/ari/resource_bridges.c already.<br><br>ASTERISK-30239<br>ASTERISK-30237<br><br>Change-Id: I58ef9f44036feded5966b5fc70ae754f8182883d<br>---<br>M res/prometheus/bridges.c<br>1 file changed, 27 insertions(+), 1 deletion(-)<br><br></pre>
<pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/prometheus/bridges.c b/res/prometheus/bridges.c</span><br><span>index 5a91604..505dab8 100644</span><br><span>--- a/res/prometheus/bridges.c</span><br><span>+++ b/res/prometheus/bridges.c</span><br><span>@@ -125,7 +125,17 @@</span><br><span>  /* Bridge dependent values */</span><br><span>        it_bridges = ao2_iterator_init(bridges, 0);</span><br><span>  for (i = 0; (bridge = ao2_iterator_next(&it_bridges)); ao2_ref(bridge, -1), i++) {</span><br><span style="color: hsl(0, 100%, 40%);">-          struct ast_bridge_snapshot *snapshot = ast_bridge_get_snapshot(bridge);</span><br><span style="color: hsl(120, 100%, 40%);">+               struct ast_bridge_snapshot *snapshot;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+               /* Invisible bridges don't get shown externally and have no snapshot */</span><br><span style="color: hsl(120, 100%, 40%);">+           if (ast_test_flag(&bridge->feature_flags, AST_BRIDGE_FLAG_INVISIBLE)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                        continue;</span><br><span style="color: hsl(120, 100%, 40%);">+             }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+           snapshot = ast_bridge_get_snapshot(bridge);</span><br><span style="color: hsl(120, 100%, 40%);">+           if (!snapshot) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      continue;</span><br><span style="color: hsl(120, 100%, 40%);">+             }</span><br><span> </span><br><span>                for (j = 0; j < ARRAY_LEN(bridge_metric_defs); j++) {</span><br><span>                     int index = i * ARRAY_LEN(bridge_metric_defs) + j;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19367">change 19367</a>. To unsubscribe, or for help writing mail filters, 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/c/asterisk/+/19367"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I58ef9f44036feded5966b5fc70ae754f8182883d </div>
<div style="display:none"> Gerrit-Change-Number: 19367 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Holger Hans Peter Freyther <automatic@freyther.de> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>