<p>Neels Hofmeyr has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/13638">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">smpp: fix vlr_subscr use count bugs<br><br>In smpp_openbsc.c submit_to_sms(), "get" the appropriate use count upon<br>assigning sms->receiver, fixing a -1 use count upon sms_free().<br><br>Also, avoid a "put" of a NULL subscriber in the same function.<br><br>Related: OS#3930<br>Change-Id: Idaf01cd3cfa08088ce0d543d0576db957dc94262<br>---<br>M src/libmsc/smpp_openbsc.c<br>1 file changed, 8 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/38/13638/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/libmsc/smpp_openbsc.c b/src/libmsc/smpp_openbsc.c</span><br><span>index 01c39f9..151c788 100644</span><br><span>--- a/src/libmsc/smpp_openbsc.c</span><br><span>+++ b/src/libmsc/smpp_openbsc.c</span><br><span>@@ -139,7 +139,8 @@</span><br><span>              } else {</span><br><span>                     LOGP(DLSMS, LOGL_ERROR,</span><br><span>                           "SMPP neither message payload nor valid sm_length.\n");</span><br><span style="color: hsl(0, 100%, 40%);">-                  vlr_subscr_put(dest, VSUB_USE_SMPP);</span><br><span style="color: hsl(120, 100%, 40%);">+                  if (dest)</span><br><span style="color: hsl(120, 100%, 40%);">+                             vlr_subscr_put(dest, VSUB_USE_SMPP);</span><br><span>                         return ESME_RINVPARLEN;</span><br><span>              }</span><br><span>    }</span><br><span>@@ -152,6 +153,12 @@</span><br><span> </span><br><span>         /* fill in the destination address */</span><br><span>        sms->receiver = dest;</span><br><span style="color: hsl(120, 100%, 40%);">+      if (dest) {</span><br><span style="color: hsl(120, 100%, 40%);">+           /* Replace use count from above subscr_by_dst (VSUB_USE_SMPP) by the sms->receiver use count</span><br><span style="color: hsl(120, 100%, 40%);">+                * (VSUB_USE_SMS_RECEIVER) */</span><br><span style="color: hsl(120, 100%, 40%);">+         vlr_subscr_get(sms->receiver, VSUB_USE_SMS_RECEIVER);</span><br><span style="color: hsl(120, 100%, 40%);">+              vlr_subscr_put(dest, VSUB_USE_SMPP);</span><br><span style="color: hsl(120, 100%, 40%);">+  }</span><br><span>    sms->dst.ton = submit->dest_addr_ton;</span><br><span>  sms->dst.npi = submit->dest_addr_npi;</span><br><span>  if (dest)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/13638">change 13638</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/13638"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-msc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Idaf01cd3cfa08088ce0d543d0576db957dc94262 </div>
<div style="display:none"> Gerrit-Change-Number: 13638 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>