<p dir="auto">This fixes a memory leak of a Lua context. In the process quite some refactoring needed to be done and some more checks on the data osm2pgsql receives from Lua scripts. See the individual commits.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/openstreetmap/osm2pgsql/pull/1669'>https://github.com/openstreetmap/osm2pgsql/pull/1669</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href="https://github.com/openstreetmap/osm2pgsql/pull/1669/commits/4a29d42d4bff574d8249e0ddb5e71d80f93f71e8" class="commit-link">4a29d42</a>  Function names in Lua tagtransform are not variable, use constants</li>
  <li><a href="https://github.com/openstreetmap/osm2pgsql/pull/1669/commits/95c7c7f72aa50f5313426b7d347dccd4f5e9ddb5" class="commit-link">95c7c7f</a>  Simplify lua_tagtransform_t::clone() functionality</li>
  <li><a href="https://github.com/openstreetmap/osm2pgsql/pull/1669/commits/466089d54f34267c85315dc7e0f4a1f5949604b2" class="commit-link">466089d</a>  Fix memory leak by using unique_ptr for Lua state</li>
  <li><a href="https://github.com/openstreetmap/osm2pgsql/pull/1669/commits/fa4a9ef535537336d15d24682a03c7071957a9ca" class="commit-link">fa4a9ef</a>  Improved check for data we get from the Lua config</li>
  <li><a href="https://github.com/openstreetmap/osm2pgsql/pull/1669/commits/55aa66a82ac568d434f408e0b4028a43d6c3bdab" class="commit-link">55aa66a</a>  A bit of code cleanup of Lua tagtransform code</li>
</ul>

<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/osm2pgsql/pull/1669/files">3 files</a>)</p>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1669/files#diff-3e141c59057160616eb086f0dc7f0107d22b75c64f3de35c0c081034980e5d13">src/tagtransform-lua.cpp</a>
    (215)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1669/files#diff-c332a275ee6e47a0782cacbe19626986d1eeba75c4e4074c147017bb5a2fbc9b">src/tagtransform-lua.hpp</a>
    (34)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1669/files#diff-b8c4e3e97d822a53f392be7f3d334748b26b20c1c24c2249b7e9b8cf161580e6">src/tagtransform.cpp</a>
    (3)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/openstreetmap/osm2pgsql/pull/1669.patch'>https://github.com/openstreetmap/osm2pgsql/pull/1669.patch</a></li>
  <li><a href='https://github.com/openstreetmap/osm2pgsql/pull/1669.diff'>https://github.com/openstreetmap/osm2pgsql/pull/1669.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/osm2pgsql/pull/1669">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AA6353TFFUYYYM3NTJOF6C3VGLZERANCNFSM5UDDYTMQ">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AA6353QFUBVMWEIAOAUXQILVGLZERA5CNFSM5UDDYTM2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4SCIBEFA.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/osm2pgsql/pull/1669</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/osm2pgsql/pull/1669",
"url": "https://github.com/openstreetmap/osm2pgsql/pull/1669",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>