<p>Max has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/13303">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Make rate_ctr_group_free() more robust<br><br>Properly check and handle empty or NULL input.<br><br>Change-Id: I859a91ee4400b3685c05971f8c66bceca6758724<br>---<br>M src/rate_ctr.c<br>1 file changed, 5 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/03/13303/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/rate_ctr.c b/src/rate_ctr.c</span><br><span>index 75302da..b76d687 100644</span><br><span>--- a/src/rate_ctr.c</span><br><span>+++ b/src/rate_ctr.c</span><br><span>@@ -255,8 +255,11 @@</span><br><span> /*! Free the memory for the specified group of counters */</span><br><span> void rate_ctr_group_free(struct rate_ctr_group *grp)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">-    llist_del(&grp->list);</span><br><span style="color: hsl(0, 100%, 40%);">-   talloc_free(grp);</span><br><span style="color: hsl(120, 100%, 40%);">+     if (grp) {</span><br><span style="color: hsl(120, 100%, 40%);">+            if (!llist_empty(&grp->list))</span><br><span style="color: hsl(120, 100%, 40%);">+                  llist_del(&grp->list);</span><br><span style="color: hsl(120, 100%, 40%);">+         talloc_free(grp);</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span> }</span><br><span> </span><br><span> /*! Add a number to the counter */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/13303">change 13303</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.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.osmocom.org/13303"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I859a91ee4400b3685c05971f8c66bceca6758724 </div>
<div style="display:none"> Gerrit-Change-Number: 13303 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Max <msuraev@sysmocom.de> </div>