<p>Joshua Colp <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19704">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:
Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
George Joseph: Looks good to me, approved
N A: Looks good to me, but someone else must approve
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_geoloc: fix NULL pointer dereference bug<br><br>The `ast_geoloc_datastore_add_eprofile` function does not return 0 on<br>success, it returns the size of the underlying datastore. This means<br>that the datastore will be freed and its pointer set to NULL when no<br>error occured at all.<br><br>ASTERISK-30346<br><br>Change-Id: Iea9b209bd1244cc57b903b9496cb680c356e4bb9<br>---<br>M res/res_geolocation/geoloc_datastore.c<br>1 file changed, 18 insertions(+), 2 deletions(-)<br><br></pre>
<pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_geolocation/geoloc_datastore.c b/res/res_geolocation/geoloc_datastore.c</span><br><span>index 040a9bd..4e7a85e 100644</span><br><span>--- a/res/res_geolocation/geoloc_datastore.c</span><br><span>+++ b/res/res_geolocation/geoloc_datastore.c</span><br><span>@@ -255,7 +255,7 @@</span><br><span> }</span><br><span> </span><br><span> rc = ast_geoloc_datastore_add_eprofile(ds, eprofile);</span><br><span style="color: hsl(0, 100%, 40%);">- if (rc != 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (rc <= 0) {</span><br><span> ast_datastore_free(ds);</span><br><span> ds = NULL;</span><br><span> }</span><br><span>@@ -297,7 +297,7 @@</span><br><span> </span><br><span> rc = ast_geoloc_datastore_add_eprofile(ds, eprofile);</span><br><span> ao2_ref(eprofile, -1);</span><br><span style="color: hsl(0, 100%, 40%);">- if (rc != 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (rc <= 0) {</span><br><span> ast_datastore_free(ds);</span><br><span> ds = NULL;</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19704">change 19704</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/+/19704"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 20 </div>
<div style="display:none"> Gerrit-Change-Id: Iea9b209bd1244cc57b903b9496cb680c356e4bb9 </div>
<div style="display:none"> Gerrit-Change-Number: 19704 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Alexandre Fournier <afournier@wazo.io> </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-Reviewer: N A <asterisk@phreaknet.org> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>