<p>Benjamin Keith Ford <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15883">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, but someone else must approve
  Benjamin Keith Ford: Looks good to me, approved; Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">STIR/SHAKEN: OPENSSL_free serial hex from openssl.<br><br>We're getting the serial number of the certificate from openssl and<br>freeing it with ast_free(), but it needs to be freed with OPENSSL_free()<br>instead. Now we duplicate the string and free the one from openssl with<br>OPENSSL_free(), which means we can still use ast_free() on the returned<br>string.<br><br>https://wiki.asterisk.org/wiki/display/AST/OpenSIPit+2021<br><br>Change-Id: Ia6e1a4028c1933a0e1d204b769ebb9f5a11f00ab<br>---<br>M res/res_stir_shaken/stir_shaken.c<br>1 file changed, 9 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_stir_shaken/stir_shaken.c b/res/res_stir_shaken/stir_shaken.c</span><br><span>index b580773..6bc07ea 100644</span><br><span>--- a/res/res_stir_shaken/stir_shaken.c</span><br><span>+++ b/res/res_stir_shaken/stir_shaken.c</span><br><span>@@ -144,6 +144,7 @@</span><br><span>    ASN1_INTEGER *serial;</span><br><span>        BIGNUM *bignum;</span><br><span>      char *serial_hex;</span><br><span style="color: hsl(120, 100%, 40%);">+     char *ret;</span><br><span> </span><br><span>       fp = fopen(path, "r");</span><br><span>     if (!fp) {</span><br><span>@@ -188,5 +189,12 @@</span><br><span>            return NULL;</span><br><span>         }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   return serial_hex;</span><br><span style="color: hsl(120, 100%, 40%);">+    ret = ast_strdup(serial_hex);</span><br><span style="color: hsl(120, 100%, 40%);">+ OPENSSL_free(serial_hex);</span><br><span style="color: hsl(120, 100%, 40%);">+     if (!ret) {</span><br><span style="color: hsl(120, 100%, 40%);">+           ast_log(LOG_ERROR, "Failed to dup serial from openssl for certificate %s\n", path);</span><br><span style="color: hsl(120, 100%, 40%);">+         return NULL;</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%);">+   return ret;</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15883">change 15883</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/+/15883"/><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: Ia6e1a4028c1933a0e1d204b769ebb9f5a11f00ab </div>
<div style="display:none"> Gerrit-Change-Number: 15883 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>