<p><a href="https://gerrit.osmocom.org/c/osmo-mgw/+/15132">View Change</a></p><p>2 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/#/c/15132/1/src/libosmo-mgcp/mgcp_codec.c">File src/libosmo-mgcp/mgcp_codec.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/15132/1/src/libosmo-mgcp/mgcp_codec.c@117">Patch Set #1, Line 117:</a> <code style="font-family:monospace,monospace">      codec_init(codec);</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">So in here you are not longer freeing codec->subtype_name and codec->audio_name. […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Yes: codec_set() is only used by codec_add(), and invariably it uses an *unpopulated* array entry.<br>So there could be random data in that entry and we must not free those pointers.<br>Instead it is important to free the memory when removing a codec entry, i.e. before it becomes an unpopulated array entry.</p><p style="white-space: pre-wrap; word-wrap: break-word;">For clarity this function should probably go inside codec_add()...</p><p style="white-space: pre-wrap; word-wrap: break-word;">yes I'll do that quickly.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/15132/1/src/libosmo-mgcp/mgcp_codec.c@239">Patch Set #1, Line 239:</a> <code style="font-family:monospace,monospace">  memset(codec, 0, sizeof(*codec));</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">You can either drop this memset or line 96: "*codec = (struct mgcp_rtp_codec){};"</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">nice, thx</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-mgw/+/15132">change 15132</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/c/osmo-mgw/+/15132"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-mgw </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I120cab0a352a1e7b31c8f9c720c47b2c291311d7 </div>
<div style="display:none"> Gerrit-Change-Number: 15132 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Mon, 12 Aug 2019 22:35:49 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Comment-In-Reply-To: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>